A root node is the topmost node in a tree and the starting point of its hierarchy. It can have zero or more child nodes, but it has no parent. Think of it as the trunk from which the rest of the structure grows. section 2.7
Use these relationships to orient yourself in a tree:
- A parent node connects directly to one or more child nodes. section 2.7
- Nodes with the same parent are siblings; a node without children is a leaf node. section 2.7
- The root has depth 0, while other nodes receive depths based on their distance from it. section 2.7
Starting a breadth-first search
In a maze represented as a tree, breadth-first search first places the root node—the player's starting position—into a queue and marks it visited. It then processes that node, records each neighbor's parent, and queues the neighbors for later exploration. These parent links allow the path back to the root to be traced when the goal is found. section 2.10
Use the tree diagram to see the root, child nodes, depth, and height arranged together. section 2.7




