I have the following data structure for a bus service. A city node has many buses to other city node which again has many buses to other city node.
Bus and city are uniquely identified by their id.
(a:city)-[r:To]->(b:City)->[r:To]->(c:City)-[r:To]->(d:City)
Node City has properties:cityId(int) relationship To has prop:busId(int),arrivalTime(int).
Question:
Given a cityId and a busId how to write a cypher query to get the route of the bus i.e all city from start to destination sorted by the arrivalTime.
The cityId provided above ensures that the bus starts from that city.
My Guess
Match (a:City)-[r:To*]->(b:City) where a.cityId=cityid and r.busId=busId return r,b. order by r.arrivalTime