Once I have the shortest path, I need to access some additional properties that I have stored at each edge (relationship) on that path. Unfortunately, this has proved much harder than I feel it should be.
The "path" variable is just a list of the nodes visited on the path and doesn't refer at all to the edges. I tried searching based on the path, e.g.
MATCH (n[path[i]]) - [e] - (n[path[i+1]])
return e.propterty
But I can't get the syntax in terms of iterating over path at i&i+1. Any suggestions for that would be greatly appreciated - or hopefully just a much easier alternative.
A true path entity will have nodes and relationships. You can get the list of relationships from path ‘p’ using relationships(p). Each relationship consists of a startNode, endNode, properties, and type. You can access each with a method of the same name.
I see what you mean. From what I read in the docs for Dijkstra algorithm, it returns a virtual relationship with the cost attribute. As such, it doesn’t seem to include other projected relationship properties.
looks like you can get all the relationships and properties projected with the following method