@@ -122,14 +122,39 @@ CALL gds.wcc.stream('g')
122
122
123
123
The above will fail with an error indicating the missing call to `gds.aura.api.credentials()`.
124
124
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
+
125
149
126
150
==== Examples
127
151
128
152
.Projecting a graph to a GDS Session:
129
153
[source, cypher]
130
154
----
131
155
// 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
133
158
MATCH (n)
134
159
OPTIONAL MATCH (n)-->(m)
135
160
RETURN gds.graph.project('g', n, m, {}, {memory: '4GB'})
@@ -139,7 +164,7 @@ RETURN gds.graph.project('g', n, m, {}, {memory: '4GB'})
139
164
[source, cypher]
140
165
----
141
166
// you can use any alias
142
- WITH gds.aura.api.credentials() AS c
167
+ WITH gds.aura.api.credentials($clientId, $clientSecret ) AS c
143
168
CALL gds.pageRank.stream('g')
144
169
YIELD nodeId, score // must specify YIELD
145
170
RETURN *
@@ -151,6 +176,8 @@ RETURN *
151
176
Use a xref:management-ops/graph-creation/graph-project-cypher-projection.adoc[Cypher projection] to project a graph into a GDS Session.
152
177
Make sure to include all the additional parameters with the `Aura Graph Analytics Serverless` label.
153
178
179
+ Use the Cypher parallel runtime to achieve the best performance during projection.
180
+
154
181
[WARNING]
155
182
Native projections and legacy Cypher projections are not supported.
156
183
@@ -241,6 +268,11 @@ The following Additional Operations are not supported in GDS Session Cypher API:
241
268
242
269
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.
243
270
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
+
244
276
.The following Cypher statement will create the example graph in the Neo4j database:
245
277
[source, cypher, role=noplay setup-query]
246
278
----
@@ -268,6 +300,7 @@ Specify the `memory` and `ttl` parameters.
268
300
.Projecting a graph called 'myGraph' using a remote Cypher projection into a new GDS Session:
269
301
[source, cypher, role=noplay graph-project-query]
270
302
----
303
+ CYPHER runtime=parallel
271
304
WITH gds.aura.api.credentials($clientId, $clientSecret) AS credentials
272
305
MATCH (source:User)
273
306
OPTIONAL MATCH (source)-[r:LINK]->(target:User)
@@ -308,9 +341,12 @@ RETURN *
308
341
| 'myGraph' | 6 | 6 | null
309
342
|===
310
343
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.
314
350
315
351
.Run PageRank in `mutate` mode:
316
352
[source, cypher, role=noplay]
@@ -376,8 +412,13 @@ RETURN *
376
412
| 5 | [0, 0, 0, 0, 0, 0, 0, 0]
377
413
|===
378
414
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.
381
422
382
423
.Run Louvain in `write` mode:
383
424
[source, cypher, role=noplay]
@@ -395,7 +436,10 @@ RETURN communityCount, modularity
395
436
| 2 | 0.3333333333333333
396
437
|===
397
438
398
- Now we can find our results in the AuraDB instance using standard Cypher queries.
439
+
440
+
441
+ === Cleaning up
442
+
399
443
Finally, drop the projected graph, which will also delete the GDS Session.
400
444
401
445
.Drop the graph 'myGraph':
0 commit comments