({{, (RefLink[GraphHub, paclet:ref/GraphHub])[g] 
gives the set of vertices with maximum vertex degree in the underlying simple graph of g.}, {, (RefLink[GraphHub, paclet:ref/GraphHub])[g,"In"]
gives the set of vertices with maximum vertex in-degree.}, {, (RefLink[GraphHub, paclet:ref/GraphHub])[g,"Out"]
gives the set of vertices with maximum vertex out-degree.}, {, (RefLink[GraphHub, paclet:ref/GraphHub])[{v->w,…},…]
uses rules v->w to specify the graph g.}})

OpenersNotesSection(Spacer1)Details

The vertex degree for a vertex v is the number of edges incident to v.

For a directed graph, the in-degree is the number of incoming edges and the out-degree is the number of outgoing edges.

For an undirected graph, an edge is taken to be both an in-edge and out-edge.

OpenersPrimaryExamplesSection(Spacer1)Examples  (25)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Find the hub for a graph:

g=WheelGraph[6];

GraphHub[g]

Highlight:

HighlightGraph[g,%,VertexSize->Small]

OpenersExampleSection1(Spacer1)Scope  (5)

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

GraphHub[]

Directed graphs:

GraphHub[]

Use rules to specify the graph:

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

Compute the hubs with respect to vertex in-degree and vertex out-degree:

GraphHub[,"In"]

GraphHub[,"Out"]

(RefLink[GraphHub, paclet:ref/GraphHub]) works with large graphs:

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

Length[GraphHub[g]]//Timing

OpenersExampleSection3(Spacer1)Applications  (7)

The administrator is the hub of the friendship network between members of a karate club:

g=ExampleData[{"NetworkGraph","ZacharyKarateClub"}];

GraphHub[g]

Find the people with the most family members present at the family gathering:

ExampleData[{"NetworkGraph","FamilyGathering"}]

GraphHub[%]

Find the publications with the most citations in a citation network:

g=ExampleData[{"NetworkGraph","HighEnergyPhysicsTheory"}];

GraphHub[g,"In"]

With the most references to other publications:

GraphHub[g,"Out"]

The terrorist network linked to the tragic events of September 11, 2001. The ringleader of the conspiracy is the hub of the network:

ExampleData[{"NetworkGraph","September11Terrorists"}]

GraphHub[%]

The Medici family is the hub of the marriage network of the ruling families of Florence:

g=ExampleData[{"NetworkGraph","FlorentineFamilies"}];

GraphHub[g]

It is the most powerful family and has the highest betweenness centrality:

SetProperty[g,{VertexSize->"BetweennessCentrality"}]

Find the stations with the largest number of neighboring stations in the London Underground network:

GraphHub[]

Find the messages receiving the largest number of replies in the network of email sent to the MathGroup list in November 2011:

g=ExampleData[{"NetworkGraph","EmailListMathGroup"}]

GraphHub[g,"In"]

The most interesting subject of the month:

PropertyValue[{g,First[%]},"Subject"]

Compute the message generating the largest total number of messages:

s=Table[Length[VertexInComponent[g,v]],{v,VertexList[g]}];

Pick[VertexList[g],s,Max[s]]

OpenersExampleSection4(Spacer1)Properties & Relations  (11)

(RefLink[GraphHub, paclet:ref/GraphHub]) gives the center of a graph with respect to (RefLink[DegreeCentrality, paclet:ref/DegreeCentrality]):

g=RandomGraph[BernoulliGraphDistribution[15,0.2,DirectedEdges->True]]

GraphHub[g]

a=DegreeCentrality[g];

Pick[VertexList[g],a,Max[a]]

With respect to in-degree centrality:

GraphHub[g,"In"]

b=DegreeCentrality[g,"In"];

Pick[VertexList[g],b,Max[b]]

With respect to out-degree centrality:

GraphHub[g,"Out"]

c=DegreeCentrality[g,"Out"];

Pick[VertexList[g],c,Max[c]]

For simple graphs, (RefLink[GraphHub, paclet:ref/GraphHub]) gives the center with respect to (RefLink[VertexDegree, paclet:ref/VertexDegree]):

g=RandomGraph[BernoulliGraphDistribution[15,0.2,DirectedEdges->True]]

GraphHub[g]

a=VertexDegree[g];

Pick[VertexList[g],a,Max[a]]

Or with respect to (RefLink[VertexInDegree, paclet:ref/VertexInDegree]):

GraphHub[g,"In"]

b=VertexInDegree[g];

Pick[VertexList[g],b,Max[b]]

Or with respect to (RefLink[VertexOutDegree, paclet:ref/VertexOutDegree]):

GraphHub[g,"Out"]

c=VertexOutDegree[g];

Pick[VertexList[g],c,Max[c]]

Self-loops are ignored:

g=Graph[{1\[UndirectedEdge]1,1\[UndirectedEdge]2,1\[UndirectedEdge]4,4\[UndirectedEdge]5,4\[UndirectedEdge]6},VertexSize->Medium];

HighlightGraph[g,GraphHub[g]]

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

HighlightGraph[#,GraphHub[#]]&/@Table[CompleteGraph[n,VertexSize->{"Scaled",0.04}],{n,3,6}]

For a (RefLink[PathGraph, paclet:ref/PathGraph]), all vertices except for the endpoints are hubs:

HighlightGraph[#,GraphHub[#]]&/@Table[PathGraph[Range[n],VertexSize->{"Scaled",0.06}],{n,5,8}]

For a (RefLink[CycleGraph, paclet:ref/CycleGraph]), every vertex is a hub:

HighlightGraph[#,GraphHub[#]]&/@Table[CycleGraph[n,VertexSize->{"Scaled",0.04}],{n,3,6}]

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

HighlightGraph[#,GraphHub[#]]&/@Table[WheelGraph[n,VertexSize->{"Scaled",0.04}],{n,5,8}]

For a (RefLink[GridGraph, paclet:ref/GridGraph]), all vertices that are not at an edge of the grid are hubs:

HighlightGraph[#,GraphHub[#]]&/@Table[GridGraph[dim,VertexSize->{"Scaled",0.04},ImageSize->{Tiny,Tiny}],{dim,{{3,3},{3,4},{4,4},{4,5}}}]

For a (RefLink[CompleteKaryTree, paclet:ref/CompleteKaryTree]), all vertices except for the leaves and the root are hubs:

HighlightGraph[#,GraphHub[#]]&/@Table[CompleteKaryTree[n,VertexSize->{"Scaled",0.04}],{n,3,5}]

The center of a graph with respect to (RefLink[EccentricityCentrality, paclet:ref/EccentricityCentrality]) is obtained with (RefLink[GraphCenter, paclet:ref/GraphCenter]):

g=GraphUnion[GridGraph[{5,5}],Graph[{3\[UndirectedEdge]26,18\[UndirectedEdge]22,18\[UndirectedEdge]24,3\[UndirectedEdge]9,3\[UndirectedEdge]7}],VertexSize->Large];

HighlightGraph[g,GraphCenter[g]]

The set of vertices with maximum (RefLink[VertexEccentricity, paclet:ref/VertexEccentricity]) is obtained with (RefLink[GraphPeriphery, paclet:ref/GraphPeriphery]):

HighlightGraph[g,GraphPeriphery[g]]

The (RefLink[BetweennessCentrality, paclet:ref/BetweennessCentrality]) center of a graph:

g=GraphUnion[GridGraph[{5,5}],Graph[{3\[UndirectedEdge]26,18\[UndirectedEdge]22,18\[UndirectedEdge]24,3\[UndirectedEdge]9,3\[UndirectedEdge]7}],VertexSize->Large];

c[s_]:=Pick[VertexList[g],s,Max[s]]

HighlightGraph[g,c[BetweennessCentrality[g]]]

The (RefLink[ClosenessCentrality, paclet:ref/ClosenessCentrality]) center:

HighlightGraph[g,c[ClosenessCentrality[g]]]

The (RefLink[EigenvectorCentrality, paclet:ref/EigenvectorCentrality]) center:

HighlightGraph[g,c[EigenvectorCentrality[g]]]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Self-loops are not accounted for:

g=Graph[{1\[UndirectedEdge]1,1\[UndirectedEdge]2,1\[UndirectedEdge]4,4\[UndirectedEdge]5,4\[UndirectedEdge]6},VertexSize->Medium];

HighlightGraph[g,GraphHub[g]]

Use (RefLink[VertexDegree, paclet:ref/VertexDegree]) to find the center with self-loops included:

d=VertexDegree[g];
HighlightGraph[g,Pick[VertexList[g],d,Max[d]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[VertexDegree, paclet:ref/VertexDegree])  ▪  (RefLink[VertexInDegree, paclet:ref/VertexInDegree])  ▪  (RefLink[VertexOutDegree, paclet:ref/VertexOutDegree])  ▪  (RefLink[DegreeCentrality, paclet:ref/DegreeCentrality])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Properties & Measurements, paclet:guide/GraphPropertiesAndMeasurements])}})}})