gives a list of betweenness centralities for the vertices in the graph g.
BetweennessCentrality[{vw,…}]
uses rules vw to specify the graph g.
BetweennessCentrality
gives a list of betweenness centralities for the vertices in the graph g.
BetweennessCentrality[{vw,…}]
uses rules vw to specify the graph g.
Details
- BetweennessCentrality will give high centralities to vertices that are on many shortest paths of other vertex pairs.
- BetweennessCentrality for a vertex
in a connected graph is given by
, where
is the number of shortest paths from
to
and
is the number of shortest paths from
to
passing through
. - The ratio
is taken to be zero when there is no path from
to
. - BetweennessCentrality works with undirected graphs, directed graphs, multigraphs, and mixed graphs.
Examples
open all close allBasic Examples (2)
Compute betweenness centralities:
g = ExampleData[{"NetworkGraph", "Friendship"}];BetweennessCentrality[g]HighlightGraph[g, VertexList[g], VertexSize -> Thread[VertexList[g] -> Rescale[%]]]Rank vertices. Highest-ranked vertices are on many shortest paths of other vertex pairs:
g = ExampleData[{"NetworkGraph", "Friendship"}];Sort[BetweennessCentrality[g], Greater]Part[VertexList[g], Ordering[BetweennessCentrality[g], All, Greater]]Scope (6)
BetweennessCentrality works with undirected graphs:
BetweennessCentrality[[image]]BetweennessCentrality[[image]]BetweennessCentrality[[image]]BetweennessCentrality[[image]]Use rules to specify the graph:
BetweennessCentrality[{1 -> 3, 2 -> 1, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 1}]BetweennessCentrality works with large graphs:
g = GridGraph[{10, 10, 10, 10}];BetweennessCentrality[g]//Short//TimingApplications (6)
Rank vertices by the fraction of shortest paths between other vertices:
g = [image];SortBy[{VertexList[g], BetweennessCentrality[g]}, Last]//ReverseHighlight the betweenness centrality for CycleGraph:
HighlightCentrality[g_, cc_] := HighlightGraph[g, Table[Style[VertexList[g][[i]], ColorData["TemperatureMap"][cc[[i]] / Max[cc]]], {i, VertexCount[g]}]];g = CycleGraph[8, VertexSize -> Large];cc = BetweennessCentrality[g];HighlightCentrality[g, cc]g = GridGraph[{10, 10}, VertexSize -> Large];cc = BetweennessCentrality[g];HighlightCentrality[g, cc]g = CompleteKaryTree[3, 3, VertexSize -> Large];cc = BetweennessCentrality[g];HighlightCentrality[g, cc]g = PathGraph[Range[20], VertexSize -> Large];cc = BetweennessCentrality[g];HighlightCentrality[g, cc]Find the members who can easily withhold or distort information in transmission in a network:
g = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];Part[VertexList[g], Ordering[BetweennessCentrality[g], -5]]HighlightGraph[g, %]A power grid network representing the topology of the Western States Power Grid of the United States. Identify critical nodes whose failures will most affect the grid:
g = ExampleData[{"NetworkGraph", "PowerGrid"}];c = BetweennessCentrality[g];Pick[VertexList[g], c, Max[c]]The neighborhood of the critical nodes:
NeighborhoodGraph[g, %, 3, GraphLayout -> "SpringEmbedding"]Find the toll station that would collect the most money in a toll road network:
g = [image];With[{c = BetweennessCentrality[g]}, Pick[VertexList[g], c, Max[c]]]For graphs with
vertices, the largest sum in differences in betweenness centrality between the most central vertex and all other vertices is
:
n = 10;
g = StarGraph[n];
c = BetweennessCentrality[g];{Total[Max[c] - c], (n - 1)((n - 1)(n - 2)) / 2}Measure how central the most central vertex is with respect to other vertices:
betweenness[g_] := With[{c = BetweennessCentrality[g], n = VertexCount[g]}, N[Total[Max[c] - c] / ((n - 1) ^ 2(n - 2) / 2)]]Centralization of social networks:
betweenness[ExampleData[{"NetworkGraph", "ZacharyKarateClub"}]]betweenness[ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}]]Properties & Relations (3)
Betweenness centralities for an undirected graph are equivalent to centralities for each component:
g = [image];BetweennessCentrality[g]Computing the centralities for each component yields the same result:
{g1, g2} = Subgraph[g, #]& /@ ConnectedComponents[g]{BetweennessCentrality[g1], BetweennessCentrality[g2]}Join@@%Betweenness centralities for isolated vertices are taken to be zero:
BetweennessCentrality[[image]]Use VertexIndex to obtain the centrality of a specific vertex:
g = ExampleData[{"NetworkGraph", "Friendship"}];BetweennessCentrality[g][[VertexIndex[g, "Anna"]]]Related Guides
Text
Wolfram Research (2010), BetweennessCentrality, Wolfram Language function, https://reference.wolfram.com/language/ref/BetweennessCentrality.html (updated 2015).
CMS
Wolfram Language. 2010. "BetweennessCentrality." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/BetweennessCentrality.html.
APA
Wolfram Language. (2010). BetweennessCentrality. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BetweennessCentrality.html
BibTeX
@misc{reference.wolfram_2026_betweennesscentrality, author="Wolfram Research", title="{BetweennessCentrality}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/BetweennessCentrality.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_betweennesscentrality, organization={Wolfram Research}, title={BetweennessCentrality}, year={2015}, url={https://reference.wolfram.com/language/ref/BetweennessCentrality.html}, note=[Accessed: 13-June-2026]}