Database Reference
In-Depth Information
Chapter 8. Traversals in depth
This chapter covers
• How traversal ordering impacts performance and memory footprint
• Using expanders during traversal
• Controlling the number of visits to each node using the uniqueness property
• Improving graph query performance using bidirectional traversals
Writing efficient traversals is the key to successfully querying graph data. You learned the
basic concepts of the Neo4j Traversal API in chapter 4 . In this chapter we're going to dig a
little deeper into the inner workings of the Traversal API so you can learn how to solve the
most complex graph problems in an efficient manner.
8.1. Traversal ordering
Every time a traverser visits a node, it needs to make a decision about which relationship to
follow and which node to visit next, repeating the process until the traversal completes. By
selecting an optimal path through the graph, the traversal can complete more quickly and
use less memory. There are two main ordering algorithms in graph theory, and they're used
for most traversals in Neo4j: depth-first and breadth-first algorithms.
To see how traversal efficiency and performance can depend on the selected ordering, look
at the graph in figure 8.1 .
 
Search WWH ::




Custom Search