Skip to content

Commit

Permalink
Merge pull request #56 from wey-gu/example_algo_from_ngql
Browse files Browse the repository at this point in the history
feat: add example of pyspark to scan data from ngql
  • Loading branch information
wey-gu authored Feb 23, 2023
2 parents d605e58 + bcd3c6a commit de2ea0c
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions spark/pagerank_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"metadata": {},
"outputs": [],
"source": [
"# option 0: read graph data for one type of edge, scan from all storaged instances\n",
"df = spark.read.format(\n",
" \"com.vesoft.nebula.connector.NebulaDataSource\").option(\n",
" \"type\", \"edge\").option(\n",
Expand All @@ -46,9 +47,29 @@
" \"returnCols\", \"degree\").option(\n",
" \"metaAddress\", \"metad0:9559\").option(\n",
" \"partitionNumber\", 1).load()\n",
"\n",
"# option 1: read graph data with ngql, get data from graphd\n",
"df = spark.read.format(\n",
" \"com.vesoft.nebula.connector.NebulaDataSource\").option(\n",
" \"type\", \"edge\").option(\n",
" \"spaceName\", \"basketballplayer\").option(\n",
" \"label\", \"follow\").option(\n",
" \"returnCols\", \"degree\").option(\n",
" \"metaAddress\", \"metad0:9559\").option(\n",
" \"graphAddress\", \"graphd:9669\").option(\n",
" \"ngql\", \"MATCH ()-[e:follow]->() return e LIMIT 1000\").option(\n",
" \"partitionNumber\", 1).load()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31871548",
"metadata": {},
"outputs": [],
"source": [
"# prConfig = PRConfig(3, 0.85)\n",
"prConfig = spark._jvm.PRConfig(3, 0.85)\n",
"\n"
"prConfig = spark._jvm.PRConfig(3, 0.85)"
]
},
{
Expand Down

0 comments on commit de2ea0c

Please sign in to comment.