3.5. Traversal

Traversing a graph means visiting its nodes, following relationships according to some rules. In most cases only a subgraph is visited, as you already know where in the graph the interesting nodes and relationships are found.

Neo4j comes with a callback based traversal API which lets you specify the traversal rules. At a basic level there’s a choice between traversing breadth- or depth-first.

For an in-depth introduction to the traversal framework, see Chapter 8, The Traversal Framework. For Java code examples see Section 4.4, “Traversal”.

Other options to traverse or query graphs in Neo4j are Cypher and Gremlin.