Reading a hierarchy as a rooted tree
A root turns a finite, undirected tree into a hierarchy. The unique path from that root to each vertex fixes its family relationships and its distance from the root. To describe a traversal, you also need a rule for visiting vertices and, when siblings can be exchanged, their specified order.
Paths and generations
For every nonroot vertex, its parent is the neighbor one edge nearer the root. A child is a neighbor one edge farther away; a vertex may have several children or none. An ancestor of a vertex lies earlier on its unique root path. A leaf has no children, even if it has a sibling.
Depth counts edges from the root, so the root has depth zero. Height counts edges on the longest downward path from a vertex to a descendant leaf.
Therefore a leaf has height zero, while the height of the whole tree is the height of its root. The two measurements start at different vertices and answer different questions.
Worked example
Suppose R has ordered children S then T, S has child U, and T has ordered children V then W.
The root path R → S → U has two edges, so U has depth 2; S has depth 1, is an ancestor of U, and is shallower than U.
Both V and W are leaves although they are siblings. The longest downward path from R has two edges, so this tree has height 2.
Preorder visits each vertex before its child subtrees, producing R, S, U, T, V, W. Postorder finishes each child subtree before its parent, producing U, S, V, W, T, R. Breadth-first order visits one depth at a time, producing R, S, T, U, V, W. Each sequence uses the stated sibling order.
Root P has children Q and R; Q has child S; S has child T; R has child U. How many edges is the height of Q?
In an ordered rooted tree, M has children N then O; N has children P then Q; O has child R. Which sequence is preorder?