Skip to content

Commit 02ed560

Browse files
committed
Drop graph after computation
1 parent 91df388 commit 02ed560

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

cypher/queries/interactive-complex-14.cypher

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
27 AS person2Id
77
}
88
*/
9-
CALL gds.graph.drop('q14graph', false)
10-
YIELD graphName
11-
12-
// ----------------------------------------------------------------------------------------------------
13-
WITH count(*) AS dummy
14-
// ----------------------------------------------------------------------------------------------------
15-
169
// Check whether a path exists -- if there is no path, the query will return an empty result
1710
MATCH
1811
path = shortestPath((person1 {id: $person1Id})-[:KNOWS*]-(person2 {id: $person2Id}))
@@ -25,7 +18,7 @@ WITH 42 AS dummy
2518

2619
MATCH (person1:Person {id: $person1Id}), (person2:Person {id: $person2Id})
2720
CALL gds.graph.project.cypher(
28-
'q14graph',
21+
apoc.create.uuidBase64(),
2922
'MATCH (p:Person) RETURN id(p) AS id',
3023
'MATCH
3124
(pA:Person)-[knows:KNOWS]-(pB:Person),
@@ -43,13 +36,18 @@ CALL gds.graph.project.cypher(
4336
YIELD graphName
4437

4538
// ----------------------------------------------------------------------------------------------------
46-
WITH person1, person2
39+
WITH person1, person2, graphName
4740
// ----------------------------------------------------------------------------------------------------
4841

4942
CALL gds.shortestPath.dijkstra.stream(
50-
'q14graph', {sourceNode: person1, targetNode: person2, relationshipWeightProperty: 'weight'}
43+
graphName, {sourceNode: person1, targetNode: person2, relationshipWeightProperty: 'weight'}
5144
)
5245
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
5346

47+
WITH path, totalCost, graphName
48+
49+
CALL gds.graph.drop(graphName, false)
50+
YIELD graphName as graphNameremoved
51+
5452
RETURN [person IN nodes(path) | person.id] AS personIdsInPath, totalCost AS pathWeight
5553
LIMIT 1

0 commit comments

Comments
 (0)