Skip to content

Instantly share code, notes, and snippets.

@emaadmanzoor
Last active November 16, 2021 19:21
Show Gist options
  • Save emaadmanzoor/5cb814250916ac030db531e7db30c5ad to your computer and use it in GitHub Desktop.
Save emaadmanzoor/5cb814250916ac030db531e7db30c5ad to your computer and use it in GitHub Desktop.
MATCH (source:Place {id: "Amsterdam"}), (destination:Place {id: "London"})
CALL gds.shortestPath.dijkstra.stream({
nodeProjection: 'Place',
relationshipProjection: {
ROAD: {
type: 'EROAD',
properties: 'distance',
orientation: 'UNDIRECTED'
}
},
sourceNode: source,
targetNode: destination,
relationshipWeightProperty: null
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
RETURN
index,
gds.util.asNode(sourceNode).name AS sourceNodeName,
gds.util.asNode(targetNode).name AS targetNodeName,
totalCost,
[nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
costs,
nodes(path) as path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment