Skip to main content
1 of 2
Andrew D. King
  • 1.8k
  • 2
  • 17
  • 18

To state more directly what Joseph said, if we know the distance between any two vertices, it is straightforward to first find the eccentricity of $v$, i.e. the maximum distance from $v$ to another vertex. Having done this we simply mark the vertices of lowest eccentricity as being central.

To find the distance between every pair of vertices, one can apply the Floyd-Warshall algorithm for all-pairs shortest path, which runs in $O(n^3)$ time.

http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm

Andrew D. King
  • 1.8k
  • 2
  • 17
  • 18