Graph Theory37 sections · 1633 units
Open in Course

Example: Finding a Centroid

(Walking through the process)

Tree: 121-2, 131-3, 343-4, 353-5. Five nodes total. Start at node 11. Its subtrees have sizes 11 (node 22) and 33 (rooted at 33). Node 33's subtree exceeds 5/2=2.55/2 = 2.5, so move to node 33. From node 33, its children 44 and 55 each have size 11, and the parent direction has size 22 (nodes 11 and 22).

No component exceeds 2.52.5. Node 33 is the centroid. You walked from root to centroid in one step. The algorithm terminated quickly because the tree is small and well-balanced.