({{, (RefLink[GraphCenter, paclet:ref/GraphCenter])[g] 
gives the set of vertices with minimum eccentricity in the graph g.}, {, (RefLink[GraphCenter, paclet:ref/GraphCenter])[{v->w,…}]
uses rules v->w to specify the graph g.}})

OpenersNotesSection(Spacer1)Details

The following options can be given:

Possible (RefLink[Method, paclet:ref/Method]) settings include "Dijkstra", "FloydWarshall", and "Johnson".

OpenersPrimaryExamplesSection(Spacer1)Examples  (16)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Give the graph center for a graph:

g=WheelGraph[6,VertexSize->Small]

GraphCenter[%]

Highlight the center:

HighlightGraph[g,%]

OpenersExampleSection1(Spacer1)Scope  (7)

(RefLink[GraphCenter, paclet:ref/GraphCenter]) works with undirected graphs:

GraphCenter[]

Directed graphs:

GraphCenter[]

Weighted graphs:

GraphCenter[]

Multigraphs:

GraphCenter[]

Mixed graphs:

GraphCenter[]

Use rules to specify the graph:

GraphCenter[{1->2,2->3,3->1,3->4,4->5,5->3}]

Works with large graphs:

g=GridGraph[{10,10,10,10}];

Timing[GraphCenter[g]//Length]

VertexCount[g]

OpenersExampleSection3(Spacer1)Applications  (1)

People at a family gathering:

people={"Elisabeth","James","Anna","John","Dorothy","Linda","Michael","Larry","Carol","Nancy","David","Nora","Julia","Ben","Oscar","Felicia","Arlene","Rudy"};

Use (RefLink[Subsets, paclet:ref/Subsets]) to create edges between all members of the family:

UndirectedEdge@@@Subsets[{"John","Dorothy","David"},{2}]

relations=Join@@Table[UndirectedEdge@@@Subsets[family,{2}],{family,{{"Elisabeth","Anna"},{"James","Anna","Linda","Larry","Nancy"},{"John","Dorothy","David"},{"Linda","Michael","Nora","Julia"},{"Larry","Carol","Ben","Oscar"},{"Nancy","David","Arlene"},{"Oscar","Felicia"},{"Arlene","Rudy"}}}];

The resulting social graph:

g=Graph[people,relations,VertexShapeFunction->"Name"]

Find the people who are most closely related to everybody at the gathering:

GraphCenter[g]

OpenersExampleSection4(Spacer1)Properties & Relations  (7)

In a connected graph, the center can be found using (RefLink[VertexEccentricity, paclet:ref/VertexEccentricity]):

g=GridGraph[{3,4}]

VertexEccentricity[g,#]&/@VertexList[g]

Flatten[Position[%,Min[%]]]

GraphCenter[g]

For a (RefLink[CompleteGraph, paclet:ref/CompleteGraph]), every vertex is at the center:

HighlightGraph[#,GraphCenter[#]]&/@Table[CompleteGraph[n,VertexSize->Small],{n,3,6}]

For a (RefLink[PathGraph, paclet:ref/PathGraph]) with positive weights, there is either one center vertex or two center vertices:

HighlightGraph[#,GraphCenter[#]]&/@Table[PathGraph[Range[n],VertexSize->Large],{n,5,8}]

For a (RefLink[CycleGraph, paclet:ref/CycleGraph]), all vertices are in the center:

HighlightGraph[#,GraphCenter[#]]&/@Table[CycleGraph[n,VertexSize->Small],{n,3,6}]

For a (RefLink[WheelGraph, paclet:ref/WheelGraph]) of size 5 or more, the hub is the graph center:

HighlightGraph[#,GraphCenter[#]]&/@Table[WheelGraph[n,VertexSize->Small],{n,5,8}]

For a (RefLink[GridGraph, paclet:ref/GridGraph]), the center forms a grid with all dimensions being one or two:

HighlightGraph[#,GraphCenter[#]]&/@Table[GridGraph[dim,VertexSize->Medium,ImageSize->{Tiny,Tiny}],{dim,{{3,3},{3,4},{4,3},{4,4}}}]

For a (RefLink[CompleteKaryTree, paclet:ref/CompleteKaryTree]), the root vertex is the center:

HighlightGraph[#,GraphCenter[#]]&/@Table[CompleteKaryTree[n,VertexSize->Large],{n,3,5}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[VertexEccentricity, paclet:ref/VertexEccentricity])  ▪  (RefLink[GraphPeriphery, paclet:ref/GraphPeriphery])  ▪  (RefLink[GraphRadius, paclet:ref/GraphRadius])  ▪  (RefLink[GraphDiameter, paclet:ref/GraphDiameter])  ▪  (RefLink[GraphDistanceMatrix, paclet:ref/GraphDistanceMatrix])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Paths, Cycles, and Flows, paclet:guide/GraphPathsCyclesAndFlows])}})}})