I want to find center in a graph that doesn't have cycles. I heard, that this is how I find a diameter:
- Take random vertex A
- Find such vertex B, that distance to it is maximal
- Find such vertex C, that distance from B to C is maximal
- BC is diameter
And then I just divide it equally.
But how to prove this diameter finding algorithm? Why is it valid?
Best Answer
The solution for problem 4 in HW3_Solution.pdf gives a detailed proof. There is also the same question Prove traversing a k-ary tree twice yields the diameter asked on Stack Overflow.