Hi, I have a question about allshortestpath algorithm in gds.
When I run the query like this:
nodeQuery: 'MATCH (n:Loc) RETURN id(n) AS id',
relationshipQuery: 'MATCH (n:Loc)-[r:ROAD]-(p:Loc) RETURN id(n) AS source, id(p) AS target, r.cost AS cost',
YIELD sourceNodeId, targetNodeId, distance
WITH sourceNodeId, targetNodeId, distance
WHERE gds.util.isFinite(distance) = true
MATCH (source:Loc) WHERE id(source) = sourceNodeId
MATCH (target:Loc) WHERE id(target) = targetNodeId
WITH source, target, distance WHERE source <> target
RETURN source.name AS source, target.name AS target, distance
ORDER BY distance DESC, source ASC, target ASC
I find that when I call the gds.alpha.allShortestPaths, the output is only sourceNodeId, targetNodeId and distance. Is it true? I want get the information of links and nodes for each path. Can I get them by calling gds?
Many thanks for your help.
Thank you for your help.
Yes, according to this post, I have similar scenario with tenkaleakshay94, but in the case first. That is, I need the shortest path to every label2 node.
So now, I have a large network and I need to get the shortest path information for all node pairs.
But it is too much time consuming.
So I am looking for methods can improve the performance.
Do you have any ideas about how to improve the query performance?
Without knowing you real usecase I'm not sure I can help you with the performance problem.
When running an algorithm to get all nodepairs shortest paths will take alot of time to perform. Because it will traverse all nodes multiple times.
You mentioned earlier that you need to calculate on nodes that is crossed. Perhaps a centrality algorithm would help you.