Created
July 12, 2022 18:39
-
-
Save petehughes/27caa3285cffb52fdc75a179ba83737c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%cypher | |
MATCH path = shortestPath( (:Station {name:'Watford'})-[:LEG*]-(:Station {name: 'Liverpool Street'}) ) | |
with [n in nodes(path)|n.name] as Stations, [n in relationships(path)|n.line] as AlLines, reduce(time = 0, n in relationships(path) | time + n.time) as time | |
where time > 0 | |
with [i in range(0, size(AlLines)-1) | |
WHERE i=0 OR AlLines[i] <> AlLines[i-1] | AlLines[i] ] AS Lines, AlLines, Stations, time | |
RETURN Lines, Stations, time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment