I run gds.alpha.kShortestPaths.stream
using Neo4j 4.0.2. The algorithm yields a path.
The path has the nodes connected with NEXT
relationship. I need to find the actual relationships in the Graph that connect the nodes in the path. I came up with a kludgy query that is based on my knowing how long the path is:
...
YIELD path
with nodes(path) as nodes with nodes[0] as n0, nodes[1] as n1, nodes[2] as n2, nodes[3] as n3
match (n0)-[r1]-(n1)
match (n1)-[r2]-(n2)
match (n2)-[r3]-(n3)
return n0, n1, n2, n3, r1, r2, r3
Obviously this solution is inadequate and the only reason I posted it here is to illustrate what I need to do for a path of any length.
Thank you