cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Order paths (circuits) by oldest relationship

I'm working with a database that tracks IOUs. People are nodes (Person) and IOUs are relationships (OWES). OWES has a property of Date.

I need to search for simple circuits (paths that originate and end with the same node), and identify the circuit that includes the oldest transaction (OWES:Date).

To search for paths I've got:

MATCH p=(a)-[*]->(a)

When there is more than one path, I want to find the one that includes the relationship with the smallest value in the Date property.

I'm a Cypher newbie, and any suggestions would be greatly appreciated!

2 REPLIES 2

Similarly, once I've found the path with the oldest transaction, I need to find the transaction in that path that has the lowest Amount. More specifically, I just need to have the amount.

Hi Ryan,

Looking for some to resolve a query requires calculating 2 flights involved in total journey. Could you please help.
MATCH (sapt:Airport{airportName:"Sochi International Airport"}),(cba:Airport{airportName:"Chelyabinsk Balandino Airport"}), path = shortestPath((sapt)-[]-(cba)) with path
MATCH (p:Flight) WHERE p.flightID STARTS WITH '
' RETURN sum(p.duration)AS Total_Duration, path

I am trying find a way, request your help.

thanks
Srini

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online