In a graph G, if d(u,v) is the shortest length between two nodes u and v (ie
the number of edges of the shortest path) let m(u) be the sum of d(u,v) for
all nodes v of G. Centroid of a graph G is a subgraph induced by vertices u
with minimum m(u).
This algorithm needs that APSP algorithm has been computed before its own
Output will be:
A is not in the centroid
B is not in the centroid
C is not in the centroid
D is in the centroid
E is not in the centroid
F is not in the centroid
G is not in the centroid
F. Harary, Graph Theory. Westview Press, Oct. 1969. [Online].