Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Traverse Neo4J nodes ordered by relation property in Java

Is it possible to traverse nodes ordered by a property given by relations in the Java API?

Source node *--- 4 ---> * Node 1
            |
            +--- 3 ---> * Node 2
            |
            +--- 2 ---> * Node 3
            |
            '--- 1 ---> * Node 4

Where *'s are nodes and the numbers between -'s are relation properties. Such that the above would give the nodes 4, 3, 2 and 1.

like image 856
wolfgarnet Avatar asked Mar 05 '26 15:03

wolfgarnet


1 Answers

You would have to get all those relationships and sort them first then. If you're using that in a traversal then such a behaviour can be encoded in a RelationshipExpander.

like image 110
Mattias Finné Avatar answered Mar 07 '26 06:03

Mattias Finné



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!