In addition to root, many different terms are used to describe the attributes of a tree. A leaf is any node with an outdegree of zero. A node that is not a root or a leaf is known as an internal node because it is found in the middle portion of a tree. A leaf, being a node with no successor, is also called terminal node.
A node is a parent (predecessor) if it has successor nodes – that is, if it has an outdegree greater than zero. Conversely, a node with a predecessor is a child (Successor). A child node has an indegree of one. Two or more nodes with the same parent are siblings. An ancestor is any node in the path from the root to the node. A descendent is any node in the path below the parent node; that is, all nodes in the paths from a given node to a leaf are descendents of the node.
A descendent is any node in the path below the parent node; that is, all nodes in the paths from a given node to a leaf are descendents of the node.
The level of a node is its distance from the root. Because the root has a zero distance from itself, the root is at level 0. The children of the root are at level 1, their children are level 2, and so forth.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment