Conclusion
This chapter covered the treatment of graphs, trees, and hierarchies. I presented iterative/recursive solutions for graphs, and also solutions where you materialize information describing a tree. The main advantage of the iterative/recursive solutions is that you don’t need to materialize and maintain any additional attributes; rather, the graph manipulation is based on the stored edge attributes. The materialized path solution materializes an enumerated path, and possibly also the level for each node in the tree. The maintenance of the additional information is not very expensive, and you benefit from simple and fast set-based queries. The nested sets solution materializes left and right values representing set containment relationships, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access