Hi guys, I have a problem with my neo4j project. I'm trying to return a path made by a dijkstra shortest path algorithm:
query_balanced = """
MATCH (s:RoadJunction {id: '%s'}), (t:RoadJunction {id: '%s'})
CALL gds.shortestPath.dijkstra.stream('subgraph_routing', {
sourceNode: s,
targetNode: t,
relationshipWeightProperty: 'comfort_cost'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, path
WITH totalCost AS balanced_cost, nodeIds, path
UNWIND relationships(path) AS r
WITH nodeIds, balanced_cost, SUM(r.distance) AS total_distance
WHERE total_distance <= 1.05 * %f
RETURN nodeIds, balanced_cost, total_distance
""" % (source, target, shortest_distance)
The problem is that after relationships(path) AS r when I calculate "total _distance" it gives me zero as result. I found that r.distance doesn't exists in any record of relatioships(path), there is only the property "cost". In my graph the relation ROUTE has the property distance, so I don't understand why when i use relationships(path) this doesn't return the correct properties.