|
| 1 | +== Graph Analytics |
| 2 | + |
| 3 | +Graph Analytics is a powerful feature of Neo4j Aura that allows users to run complex algorithms on their graph data. This functionality is particularly useful for tasks such as community detection, pathfinding, and centrality analysis. |
| 4 | + |
| 5 | +More information about Aura Graph Analytics can be found in the Neo4j link:https://neo4j.com/docs/aura/graph-analytics[documentation]. |
| 6 | + |
| 7 | +=== Pre-requisites |
| 8 | + |
| 9 | +In order to use Graph Analytics, you need to create a set of Aura-API credentials. This can be done through the Neo4j Aura console. |
| 10 | +// TODO: add link to the documentation on how to create Aura-API credentials |
| 11 | + |
| 12 | +=== Using the Graph Analytics Cypher API |
| 13 | + |
| 14 | +The Graph Analytics Cypher API provides a straightforward way to execute graph algorithms directly within your Neo4j database using Cypher queries. |
| 15 | +More details on how to use the Cypher API can be found ... |
| 16 | + |
| 17 | +==== Project a graph |
| 18 | + |
| 19 | +.Projecting a graph to a GDS Session: |
| 20 | +[source, cypher] |
| 21 | +---- |
| 22 | +CYPHER runtime=parallel |
| 23 | +WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials |
| 24 | +MATCH (n) |
| 25 | +OPTIONAL MATCH (n)-->(m) |
| 26 | +RETURN gds.graph.project('myGraph', n, m, {}, {memory: '4GB'}) |
| 27 | +---- |
| 28 | + |
| 29 | +==== Run an algorithm |
| 30 | + |
| 31 | +.Run an algorithm on the projected graph: |
| 32 | +[source, cypher] |
| 33 | +---- |
| 34 | +WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials |
| 35 | +CALL gds.pageRank.mutate('myGraph', { mutateProperty: 'pageRank' }) |
| 36 | +YIELD ranIterations, nodePropertiesWritten |
| 37 | +RETURN ranIterations, nodePropertiesWritten |
| 38 | +---- |
| 39 | + |
| 40 | +==== Write-back algorithm result to the AuraDB |
| 41 | + |
| 42 | +.Write-back the result of the algorithm to the AuraDB: |
| 43 | +[source, cypher] |
| 44 | +---- |
| 45 | +WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials |
| 46 | +CALL gds.graph.nodeProperty.write('myGraph', 'pageRank') |
| 47 | +YIELD nodesWritten |
| 48 | +RETURN nodesWritten |
| 49 | +---- |
| 50 | + |
| 51 | +=== Using the Python Client |
| 52 | + |
| 53 | +[source, bash, copy=true] |
| 54 | +---- |
| 55 | +pip install neo4j |
| 56 | +---- |
| 57 | + |
| 58 | + |
| 59 | + |
1 | 60 | == Setup Instructions
|
2 | 61 |
|
| 62 | +* create AuraDB instance |
| 63 | +* create Aura-API credentials (can be skipped in the near future) |
| 64 | +* use Cypher API |
| 65 | + * project Graph |
| 66 | + * run algorithm |
| 67 | + * write-back |
| 68 | +* use Python client |
| 69 | + * `pip install graphdatascience`` |
| 70 | + * project Graph |
| 71 | + * run algorithm |
| 72 | + * write-back |
| 73 | + |
3 | 74 | See https://neo4j.com/docs/aura/graph-analytics/[documentation]
|
0 commit comments