Skip to content

Commit c3673f4

Browse files
authored
Merge pull request #10569 from neo-technology/gds-session-cypher-api-doc-improve
Improve Cypher API docs
2 parents 192b818 + a7f75bf commit c3673f4

File tree

1 file changed

+52
-8
lines changed

1 file changed

+52
-8
lines changed

doc/modules/ROOT/pages/installation/aura-graph-analytics-serverless.adoc

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,39 @@ CALL gds.wcc.stream('g')
122122

123123
The above will fail with an error indicating the missing call to `gds.aura.api.credentials()`.
124124

125+
.Syntax
126+
[source, cypher]
127+
----
128+
RETURN gds.aura.api.credentials(
129+
clientId: String,
130+
clientSecret: String
131+
) AS credentials
132+
----
133+
134+
.Configuration
135+
[opts="header",cols="3,2,3m,2,8"]
136+
|===
137+
| Name | Type | Default | Optional | Description
138+
| clientId | String | n/a | no | The Client ID for an Aura API key pair.
139+
| clientSecret | String | n/a | no | The Client Secret for an Aura API key pair.
140+
|===
141+
142+
.Results
143+
[opts="header"]
144+
|===
145+
| Name | Type | Description
146+
| - | - | Always returns `null`.
147+
|===
148+
125149

126150
==== Examples
127151

128152
.Projecting a graph to a GDS Session:
129153
[source, cypher]
130154
----
131155
// you can use any alias
132-
WITH gds.aura.api.credentials() AS credentials
156+
CYPHER runtime=parallel
157+
WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials
133158
MATCH (n)
134159
OPTIONAL MATCH (n)-->(m)
135160
RETURN gds.graph.project('g', n, m, {}, {memory: '4GB'})
@@ -139,7 +164,7 @@ RETURN gds.graph.project('g', n, m, {}, {memory: '4GB'})
139164
[source, cypher]
140165
----
141166
// you can use any alias
142-
WITH gds.aura.api.credentials() AS c
167+
WITH gds.aura.api.credentials($clientId, $clientSecret) AS c
143168
CALL gds.pageRank.stream('g')
144169
YIELD nodeId, score // must specify YIELD
145170
RETURN *
@@ -151,6 +176,8 @@ RETURN *
151176
Use a xref:management-ops/graph-creation/graph-project-cypher-projection.adoc[Cypher projection] to project a graph into a GDS Session.
152177
Make sure to include all the additional parameters with the `Aura Graph Analytics Serverless` label.
153178

179+
Use the Cypher parallel runtime to achieve the best performance during projection.
180+
154181
[WARNING]
155182
Native projections and legacy Cypher projections are not supported.
156183

@@ -241,6 +268,11 @@ The following Additional Operations are not supported in GDS Session Cypher API:
241268

242269
In this section we will illustrate how to use the GDS Session Cypher API to project a graph, run a few algorithms, and process results.
243270

271+
272+
=== Projecting a graph
273+
274+
In order to project a graph into a GDS Session, we need to have some data in our database.
275+
244276
.The following Cypher statement will create the example graph in the Neo4j database:
245277
[source, cypher, role=noplay setup-query]
246278
----
@@ -268,6 +300,7 @@ Specify the `memory` and `ttl` parameters.
268300
.Projecting a graph called 'myGraph' using a remote Cypher projection into a new GDS Session:
269301
[source, cypher, role=noplay graph-project-query]
270302
----
303+
CYPHER runtime=parallel
271304
WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials
272305
MATCH (source:User)
273306
OPTIONAL MATCH (source)-[r:LINK]->(target:User)
@@ -308,9 +341,12 @@ RETURN *
308341
| 'myGraph' | 6 | 6 | null
309342
|===
310343

311-
With a graph projected, we can now run algorithms.
312-
First, run xref:algorithms/page-rank.adoc[] and xref:machine-learning/node-embeddings/fastrp.adoc[] in `mutate` mode.
313-
Then, `stream` the node properties and lastly `write` them back to the AuraDB instance.
344+
345+
=== Running algorithms
346+
347+
You can run algorithms on a projected graph.
348+
For example, run xref:algorithms/page-rank.adoc[] and xref:machine-learning/node-embeddings/fastrp.adoc[] in `mutate` mode on the example graph.
349+
Then, `stream` the node properties and `write` them back to the AuraDB instance.
314350

315351
.Run PageRank in `mutate` mode:
316352
[source, cypher, role=noplay]
@@ -376,8 +412,13 @@ RETURN *
376412
| 5 | [0, 0, 0, 0, 0, 0, 0, 0]
377413
|===
378414

379-
It is also possible to write the results using the `gds.graph.nodeProperty.write()` procedure.
380-
Another alternative is to write results directly using the `write` algorithm execution mode:
415+
416+
=== Writing results to database
417+
418+
It is possible to write mutated results using the `gds.graph.nodeProperty.write()` procedure.
419+
See xref:management-ops/graph-write-to-neo4j/write-back-to-nodes.adoc[] for more details.
420+
421+
You can also write results directly using the `write` algorithm execution mode.
381422

382423
.Run Louvain in `write` mode:
383424
[source, cypher, role=noplay]
@@ -395,7 +436,10 @@ RETURN communityCount, modularity
395436
| 2 | 0.3333333333333333
396437
|===
397438

398-
Now we can find our results in the AuraDB instance using standard Cypher queries.
439+
440+
441+
=== Cleaning up
442+
399443
Finally, drop the projected graph, which will also delete the GDS Session.
400444

401445
.Drop the graph 'myGraph':

0 commit comments

Comments
 (0)