GraphHub[g]
gives the set of vertices with maximum vertex degree in the underlying simple graph of g.
GraphHub[g,"In"]
gives the set of vertices with maximum vertex in-degree.
GraphHub[g,"Out"]
gives the set of vertices with maximum vertex out-degree.
GraphHub[{vw,…},…]
uses rules vw to specify the graph g.
GraphHub
GraphHub[g]
gives the set of vertices with maximum vertex degree in the underlying simple graph of g.
GraphHub[g,"In"]
gives the set of vertices with maximum vertex in-degree.
GraphHub[g,"Out"]
gives the set of vertices with maximum vertex out-degree.
GraphHub[{vw,…},…]
uses rules vw to specify the graph g.
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.
- GraphHub works with undirected graphs, directed graphs, multigraphs and mixed graphs.
Examples
open all close allBasic Examples (1)
Scope (5)
GraphHub works with undirected graphs:
GraphHub[[image]]GraphHub[[image]]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[[image], "In"]GraphHub[[image], "Out"]GraphHub works with large graphs:
g = GridGraph[{10, 10, 10, 10}];Length[GraphHub[g]]//TimingApplications (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:
Annotation[g, {VertexSize -> "BetweennessCentrality"}]Find the stations with the largest number of neighboring stations in the London Underground network:
GraphHub[\!\(\*GraphicsBox[«4»]\)]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:
AnnotationValue[{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]]Properties & Relations (11)
GraphHub gives the center of a graph with respect to 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, GraphHub gives the center with respect to VertexDegree:
g = RandomGraph[BernoulliGraphDistribution[15, 0.2, DirectedEdges -> True]]GraphHub[g]a = VertexDegree[g];Pick[VertexList[g], a, Max[a]]Or with respect to VertexInDegree:
GraphHub[g, "In"]b = VertexInDegree[g];Pick[VertexList[g], b, Max[b]]Or with respect to VertexOutDegree:
GraphHub[g, "Out"]c = VertexOutDegree[g];Pick[VertexList[g], c, Max[c]]g = Graph[{11, 12, 14, 45, 46}, VertexSize -> Medium];HighlightGraph[g, GraphHub[g]]For a CompleteGraph, every vertex is a hub:
HighlightGraph[#, GraphHub[#]]& /@ Table[CompleteGraph[n, VertexSize -> {"Scaled", 0.04}], {n, 3, 6}]For a PathGraph, all vertices except for the endpoints are hubs:
HighlightGraph[#, GraphHub[#]]& /@ Table[PathGraph[Range[n], VertexSize -> {"Scaled", 0.06}], {n, 5, 8}]For a CycleGraph, every vertex is a hub:
HighlightGraph[#, GraphHub[#]]& /@ Table[CycleGraph[n, VertexSize -> {"Scaled", 0.04}], {n, 3, 6}]For a 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 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 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 EccentricityCentrality is obtained with GraphCenter:
g = GraphUnion[GridGraph[{5, 5}], Graph[{326, 1822, 1824, 39, 37}], VertexSize -> Large];HighlightGraph[g, GraphCenter[g]]The set of vertices with maximum VertexEccentricity is obtained with GraphPeriphery:
HighlightGraph[g, GraphPeriphery[g]]The BetweennessCentrality center of a graph:
g = GraphUnion[GridGraph[{5, 5}], Graph[{326, 1822, 1824, 39, 37}], VertexSize -> Large];c[s_] := Pick[VertexList[g], s, Max[s]]HighlightGraph[g, c[BetweennessCentrality[g]]]The ClosenessCentrality center:
HighlightGraph[g, c[ClosenessCentrality[g]]]The EigenvectorCentrality center:
HighlightGraph[g, c[EigenvectorCentrality[g]]]Possible Issues (1)
Self-loops are not accounted for:
g = Graph[{11, 12, 14, 45, 46}, VertexSize -> Medium];HighlightGraph[g, GraphHub[g]]Use VertexDegree to find the center with self-loops included:
d = VertexDegree[g];
HighlightGraph[g, Pick[VertexList[g], d, Max[d]]]Related Guides
Text
Wolfram Research (2012), GraphHub, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphHub.html (updated 2015).
CMS
Wolfram Language. 2012. "GraphHub." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/GraphHub.html.
APA
Wolfram Language. (2012). GraphHub. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphHub.html
BibTeX
@misc{reference.wolfram_2026_graphhub, author="Wolfram Research", title="{GraphHub}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/GraphHub.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_graphhub, organization={Wolfram Research}, title={GraphHub}, year={2015}, url={https://reference.wolfram.com/language/ref/GraphHub.html}, note=[Accessed: 13-June-2026]}