Graph Center

Author

Eric W. Weisstein
June 3, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/GraphTheory/GraphCenter.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GraphCenter.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Examples

Table[GraphCenter/@Graphs[n],{n,3}]

Timing[centers=Table[GraphCenter/@Graphs[n],{n,7}]][[1]]

Table[Count[Length/@centers[[n]],k],{k,1,10},{n,7}]//ColumnForm

Length/@Table[Graphs[n],{n,7}]

Empty Graphs

Through[{Radius,Eccentricity,GraphCenter}[EmptyGraph[2]]]

Through[{Radius,Eccentricity,GraphCenter}[EmptyGraph[3]]]

One Center

Show[GraphicsArray[{
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Select[Graphs[3],Length[GraphCenter[#]]==1&],
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Select[Graphs[4],Length[GraphCenter[#]]==1&],
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Take[Select[Graphs[5],Length[GraphCenter[#]]==1&],4],
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Take[Select[Graphs[5],Length[GraphCenter[#]]==1&],-4]
}],GraphicsSpacing->{.2,.1}]

Two Centers

Show[GraphicsArray[{
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Select[Graphs[2],Length[GraphCenter[#]]==2&],
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Select[Graphs[4],Length[GraphCenter[#]]==2&],
Graphics[{PointSize[.1],graphic[#],
RGBColor[1,0,0],Point/@Vertices[#][[GraphCenter[#]]]
},AspectRatio->Automatic]&/@Select[Graphs[5],Length[GraphCenter[#]]==2&]
}],GraphicsSpacing->{.2,.1}]