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?