A rooted tree is a special type of tree. It is a hierarchical structure consisting of vertices and edges, with a unique root vertex from which all other vertices are accessible. The node without any children is called a leaf.
Think it as a tree in nature consists of a central trunk with branches extending outward
The term depth (or level) refers to the distance of a particular node from the root. It measures the number of edges traversed from the root to reach that specific node. The root node itself has a depth of 0, and each subsequent level increases the depth by 1.
Hover over the vertices to see their depth.
On the other hand, the height of a rooted tree is the maximum depth of any node in the tree. It is the length of the longest path from the a leaf to root.
In the interactive area, root can't be moved or removed.
Click on the vertices to add a child.
Edit the graph so that it is a rooted tree with height 4
Try to make it with 6 leaves
1
2
Depth: 0