Hi, I have a question about allshortestpath algorithm in gds.
When I run the query like this:
CALL gds.alpha.allShortestPaths.stream({
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',
relationshipWeightProperty: '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
LIMIT 10
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?
Thanks for your reply.
Yes, I think so. Since I need to calculate some complex network indicators according to the information of links between each two node
I don't need all shortest paths for all pair of nodes, but for each node pair, I need the detail path of the shortest path, like which nodes this path across.
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?