Neo4j Find Flight for Lowest Price in Ascending Order


match (a:newcity{Name:”1″}),(b:newcity{Name:”5″}),(c:Flights{Name:”AB1″}),
p = (a)-[:Route*]->(c)-[:Route*]->(b)
return p as comb, reduce(price = 0, r in relationships(p)|price+r.Price) as totalprice, c as Sector1
order by totalprice asc limit 50

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s