Trees
Formally, a tree is defined as a finite set \(T\) of one or more nodes with the following properties:
a) there is one designated node, namely the root of the given tree \(T\);
b) the remaining nodes (except the root) are distributed among \(m \geq 0\) disjoint sets \(T_{1},... , T_{m}\), and each of these sets is itself a tree; the trees \(T_{1},... , T_{m}\) are called subtrees of this root.
From this definition it follows that each node in a tree is the root of some subtree of the given tree. The number of subtrees of a node is called the degree of that node. A node with zero degree is called a terminal node or a leaf. A non-terminal node is called a branch node. The level of a node with respect to a tree T is defined recursively as follows. The level of the root of tree T is zero, and the level of any other node is one greater than the level of the root of the nearest subtree of tree T that contains the given node.
If in item (b) of the above definition the relative order of subtrees \(T_{1},... , T_{m}\) matters, then the tree is an ordered tree. If in an ordered tree \(m \geq 2\), it makes sense to call subtree \(T_{2}\) the second subtree of this root, and so on. Ordered trees are sometimes also called plane trees, since in their ordering the way the tree is laid out on a plane matters. If we do not distinguish between two trees that differ only in the relative order of subtrees of nodes, then the tree is called unordered (or unordered tree), since only the relative orientation of nodes matters, not their order.
A forest is a set (usually ordered) that contains either no disjoint trees or contains several disjoint trees. Then another formulation of item (b) in the above tree definition could read: nodes of a tree, excluding the root, form a forest.
Standard terminology for tree structures comes from genealogical "family tree" diagrams (a person's descendants). Each node is called a parent of the roots of its subtrees, and the roots themselves are called siblings or children of their parent. The root of the entire tree has no parent.
To denote kinship that may span several levels of a tree, the terms "ancestor" and "descendant" will be used.
One of the advantages of tree-based information representation is the convenience of analysis. When we place information in a tree structure, certain relationships can be seen much faster than in any text representation. In addition, trees possess certain properties that allow for efficient synthesis of information.
Links: