MATCH (from:TrainStation { stationCode:'A' }),
(to:TrainStation {stationCode:'D'}) ,
path = shortestPath( (from)-[r:train*..]->(to) )WHERE all(r in rels | r.train_no = 123) RETURN path On Tue, Mar 15, 2016 at 9:44 AM, <[email protected]> wrote: > I have Graph database in Neo4j with Train stations as nodes, and train > connecting these stations as directed relationship > > for example Train station A is connected to Train station B via > relationship train{train no : 123}, train relationship has a property > called train no . > > My question is getting a path from A to D with all intermediate stations > connected with same train number. > > A-->B-->C-->D > > For this example I should get B, C as returned nodes > > I tried > > MATCH (from:TrainStation { stationCode:'A' }), > (to:TrainStation {stationCode:'D'}) , > path = (from)-[r:train*..]->(to) > RETURN path > > This query gives me path related to all the trains, but I want to restrict > it to specific train number 123 > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
