"Given a graph G, the remoteness of a vertex v is the distance from v to the vertex u that is farthest from v in G. That is, the shortest path from v to u is as long as possible. A vertex of G with the smallest remoteness is called a middle vertex of G" Find the middle on O(n+m) where n,m are the number of vertices and edges respectively
I have this one idea and was wondering if it is valid: Start with the tree, remove all leaves on the tree. Repeat this until we have either one vertex left or we have to vertices joined by an edge. These vertices will have the shortest longest path. As these 2/1 vertices will be on the longest path/diameter of the graph and be in the middle of it. So these are middle vertices. I have applied this to some example trees and got the correct answer. Is it valid? Thanks