Abstract

A tree is a special kind of directed graph. Graphs are data structures that are made up of nodes connected by edges. There are several ways to define a tree: it is a graph with no cycles and it is a graph where all nodes except the root have indegree one and the root has indegree zero. Another defining property is that a path can be found from the root to any other node in the tree by following the edges in their natural direction. Most Structured Query Language (SQL) databases use the adjacency list model for two reasons. The first reason is that Dr. Codd came up with it in the early days of the relational model, and nobody thought about it after that. The second reason is that the adjacency list is a way of “faking” pointer chains—the traditional programming method in procedural languages for handling trees. Because SQL is a set-oriented language, the nested set model is a better model for the approach discussed in this chapter.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.