Chapter 2

Tree Template

The tree is a term from graph theory. A tree is a set of nodes that connect from child to parent. A node can have many child nodes; each node in a tree has one parent node except for the node at the tree’s top. There are no cycles — that means at most one path connects any two nodes.

Figure 2.1 shows an example of a tree. A is at the top of the tree and has no parent node. A is the parent for B, C, and D. B is the parent for E and C is the parent for F.

Figure 2.1

Figure showing sample tree. A tree organizes data into a hierarchy.

Sample tree. A tree organizes data into a hierarchy.

There are six templates for trees. The first hardcodes an entity type for each level of the tree. The others ...

Get Patterns of Data Modeling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.