Traversing tree in Neo4J

715 Views Asked by At

I am storing a very complex tree in Neo4J. This tree can be very deep. At later point of time, I need to traverse this tree in breadth first format. What would be the most efficient way of achieving this?

  1. Is there is possibility to achieve this through Cypher?
  2. Shall I use Neo4J traversal APIs?
  3. Shall I fetch all child nodes with relationships using Cypher and construct the tree by my own(writing logic in Java).
1

There are 1 best solutions below

0
On

Use the Traversal Framework, it supports BFSs. Cypher is better suited to declarative graph pattern matching-like operations, while traversals require imperative navigation operations.