Database Reference
In-Depth Information
We'll come back to this topic in chapter 8 , where we'll be covering more advanced tra-
versal concepts.
4.3. Summary
In this chapter we introduced traversals as a powerful approach to querying interconnected
data that's specific to graph databases.
In the first part of the chapter you learned how to use the Neo4j Core Java API to traverse
the sample graph and find all movies a user's friends saw. The Neo4j Core Java API is
powerful and flexible for traversing a graph, but for complex traversals the Neo4j Core
Java API implementation could quickly become complex.
That's where the Neo4j Traversal API comes in, which we discussed in the second part of
thechapter.UsingthefluentNeo4jTraversalAPI,youcandescribethetraversalqueryina
simpleanddeclarativemanner,withoutsacrificinganyofthepowerofgraphtraversal,and
with minimal performance impact.
We'll prefer the Neo4j Traversal API for most of the examples throughout the topic for its
fluencyandreadability,butinsomecomplexcaseswe'llalsodropdowntotheNeo4jCore
Java API—both approaches have their strengths and should be used to solve graph prob-
lems accordingly.
But before you start traversing a graph, you need to select one or more nodes as starting
points. In this chapter you used a known node ID to find the starting node for traversal, but
in practice it's unlikely you'll know specific node IDs—you're more likely to select a par-
ticularnodebasedononeofitsproperties.Tousethatkindof“flat”nodelookup,youneed
touseindexes, andthat'sexactly whatwe'regoingtoexplore inthenextchapter.Read on!
Search WWH ::




Custom Search