Databases Reference
In-Depth Information
That's the hard work done. All that remains is to join these routes to form the final
results. This is relatively straightforward, the only wrinkle being that the down leg's path
must be reversed before being added to the results (the leg was calculated from final
destination upward, whereas it should appear in the results delivery base downward):
private Set < Node > combineRoutes ( Path upLeg ,
Path downLeg ,
Path topRoute )
{
LinkedHashSet < Node > results = new LinkedHashSet < Node >();
results . addAll ( IteratorUtil . asCollection ( upLeg . nodes () ));
results . addAll ( IteratorUtil . asCollection ( topRoute . nodes () ));
results . addAll ( IteratorUtil . asCollection ( downLeg . reverseNodes () ));
return results ;
}
Summary
In this chapter we've looked at some common real-world use cases for graph databases,
and described in detail three case studies that show how graph databases have been used
to build a social network, implement access control, and manage complex logistics
calculations.
In the next chapter we dive deeper into the internals of a graph database. In the con‐
cluding chapter we look at some analytical techniques and algorithms for processing
graph data.
Search WWH ::




Custom Search