I am trying to add up properties in the relationship along a path. This is my first week with NEO4j and I am now stuck. If anyone can advise. Thank you
match (dbn:City {name: 'Durban'})
match (unb:City {name: 'Pinetown'})
match path = shortestpath((dbn)-[dist:DISTANCE_TO*]->(unb))
return path, sum(dist.distance)
This path has a total of 4 nodes each with a different distance total of 19kms.
it gives an error of Type Mismatch expected Map but got list
Red Node is the city. I added an additional city node for clearly seeing the shortest distance between different cities.
Now the shortest distance between Durban and Pinetown city is.
match (dbn:City {name: 'Durban'})
match (unb:City {name: 'Pinetown'})
match path = shortestpath((dbn)-[dist:DISTANCE_TO*]->(unb))
UNWIND relationships(path) AS rel
return sum(rel.distance) as total_distance