Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-21-2021 06:57 AM
Hi, I want to know how to compute shortest paths algorithms in my given below graph model.
I want to compute the graph from person to phone number
07-21-2021 12:21 PM
MATCH path=shortestPath((Node1:SYNTHETIC {person:1})-[*0..10]-(Node2:PHONE {number:xxx}))
RETURN path
07-21-2021 01:45 PM
The above example will only find the shortest path up to 10 hops (the [*0..10]
bit).
You can use the GDS pathfinding algorithms to search at greater depth, search for the n-shortest paths, or use different path finding algorithms.
An example of the syntax is:
MATCH (source:Location {name: 'A'}), (target:Location {name: 'F'})
CALL gds.shortestPath.dijkstra.stream('myGraph', {
sourceNode: source,
targetNode: target,
relationshipWeightProperty: 'cost'
})
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
ORDER BY index
07-26-2021 06:11 AM
It is not really obvious, what you are looking for...
May be I'm too used to talk to computer, but I know from them that you only get the right answer when you ask the right question. And I discovered it works with humans as the same 🙂
So please, while thinking about the kind of answer you would like to get, what would be the right question?
08-05-2021 10:30 PM
Hi,
Can anyone run or explain the above cypher queries? I do not have the graph model.
From this link I took the queries. They are not very clear.
All the sessions of the conference are now available online