So I am trying to get indirect routes in my neo4j graph consisting of stop 
and route nodes.

This the link to my graph.

Test DB 
<http://IAS_TEST_DB:enlptgp6coltxyvfu...@hobbyoppofnmjfhocgbkeljbnhenl.dbs.graphenedb.com:24789/browser/>

This is how my graph looks like.

So to get the shortest distance between A to C I'm running this query to 
get the route between A and C.

MATCH (a:Stop {name:'A'}), (d:Stop {name:'C'})
MATCH p = allShortestPaths((a)-[:STOPS_AT*..12]-(d))
RETURN EXTRACT(x IN NODES(p) | CASE WHEN x:Stop THEN 'Stop ' + x.name
                                    WHEN x:Route THEN 'Route ' + x.name
                                    ELSE '' END) AS itinerary

Which gives the output:
[Stop 12, Route 4, Stop 13, Route 5, Stop 14]


But how do I query this model to get the path with the least fare. I have 
seen other examples for it but in those examples the nodes were directly 
connected whereas in mine they are connected via Route nodes.

Plus how do I validate the routes according to the stop_order property for 
example Route A to B stops at A first and then on B while Route C to B 
stops at C first and then B so there should not be any way to reach from A 
to C but this query is not handling this particular case as well. So right 
now I am handling that in my code which I think is not the best way to do 
it.

I am stuck on this for the past two days so would appreciate any help that 
I can get.

-- 
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.

Reply via email to