Centrality Measures
Centrality measures describe the importance of a vertex to the rest of the graph using some set of criteria. Centrality measures implemented in LightGraphs.jl include the following:
LightGraphs.betweenness_centrality
LightGraphs.closeness_centrality
LightGraphs.degree_centrality
LightGraphs.eigenvector_centrality
LightGraphs.katz_centrality
LightGraphs.pagerank
LightGraphs.radiality_centrality
LightGraphs.stress_centrality
Full docs
LightGraphs.betweenness_centrality
— Function.betweenness_centrality(g[, vs])
betweenness_centrality(g, k)
parallel_betweenness_centrality(g[, vs])
parallel_betweenness_centrality(g, k)
Calculate the betweenness centrality of a graph g
across all vertices, a specified subset of vertices vs
, or a random subset of k
vertices. Return a vector representing the centrality calculated for each node in g
.
Optional Arguments
normalize=true
: If true, normalize the betweenness values by the
total number of possible distinct paths between all pairs in the graphs. For an undirected graph, this number is $\frac{(|V|-1)(|V|-2)}{2}$ and for a directed graph, ${(|V|-1)(|V|-2)}$.
endpoints=false
: If true, include endpoints in the shortest path count.
Betweenness centrality is defined as: $bc(v) = \frac{1}{\mathcal{N}} \sum_{s \neq t \neq v} \frac{\sigma_{st}(v)}{\sigma_{st}}$.
References
- Brandes 2001 & Brandes 2008
LightGraphs.closeness_centrality
— Function.closeness_centrality(g)
Calculate the closeness centrality of the graph g
. Return a vector representing the centrality calculated for each node in g
.
Optional Arguments
normalize=true
: If true, normalize the centrality value of each
node n
by $\frac{|δ_n|}{|V|-1}$, where $δ_n$ is the set of vertices reachable from node n
.
LightGraphs.degree_centrality
— Method.degree_centrality(g)
indegree_centrality(g)
outdegree_centrality(g)
Calculate the degree centrality of graph g
. Return a vector representing the centrality calculated for each node in g
.
Optional Arguments
normalize=true
: If true, normalize each centrality measure by $\frac{1}{|V|-1}$.
LightGraphs.eigenvector_centrality
— Method.eigenvector_centrality(g)
Compute the eigenvector centrality for the graph g
.
Eigenvector centrality computes the centrality for a node based on the centrality of its neighbors. The eigenvector centrality for node i
is the $i^{th}$ element of $\mathbf{x}$ in the equation $\mathbf{Ax} = λ \mathbf{x}$ where $\mathbf{A}$ is the adjacency matrix of the graph g
with eigenvalue λ.
By virtue of the Perron–Frobenius theorem, there is a unique and positive solution if λ is the largest eigenvalue associated with the eigenvector of the adjacency matrix $\mathbf{A}$.
References
- Phillip Bonacich: Power and Centrality: A Family of Measures. American Journal of Sociology 92(5):1170–1182, 1986 http://www.leonidzhukov.net/hse/2014/socialnetworks/papers/Bonacich-Centrality.pdf
- Mark E. J. Newman: Networks: An Introduction. Oxford University Press, USA, 2010, pp. 169.
LightGraphs.katz_centrality
— Function.katz_centrality(g, α=0.3)
Calculate the Katz centrality of the graph g
optionally parameterized by α
. Return a vector representing the centrality calculated for each node in g
.
LightGraphs.pagerank
— Method.pagerank(g, α=0.85, n=100, ϵ=1.0e-6)
parallel_pagerank(g, α=0.85, n=100, ϵ=1.0e-6)
Calculate the PageRank of the graph g
parameterized by damping factor α
, number of iterations n
, and convergence threshold ϵ
. Return a vector representing the centrality calculated for each node in g
, or an error if convergence is not reached within n
iterations.
LightGraphs.stress_centrality
— Function.stress_centrality(g[, vs])
stress_centrality(g, k)
parallel_stress_centrality(g[, vs])
parallel_stress_centrality(g, k)
Calculate the stress centrality of a graph g
across all vertices, a specified subset of vertices vs
, or a random subset of k
vertices. Return a vector representing the centrality calculated for each node in g
.
The stress centrality of a vertex $n$ is defined as the number of shortest paths passing through $n$.
References
- Barabási, A.L., Oltvai, Z.N.: Network biology: understanding the cell's functional organization. Nat Rev Genet 5 (2004) 101-113
- Shimbel, A.: Structural parameters of communication networks. Bull Math Biophys 15 (1953) 501-507.
LightGraphs.radiality_centrality
— Method.radiality_centrality(g)
parallel_radiality_centrality(g)
Calculate the radiality centrality of a graph g
across all vertices. Return a vector representing the centrality calculated for each node in g
.
The radiality centrality $R_u$ of a vertex $u$ is defined as $R_u = \frac{D_g + 1 - \frac{\sum_{v∈V}d_{u,v}}{|V|-1}}{D_g}$
where $D_g$ is the diameter of the graph and $d_{u,v}$ is the length of the shortest path from $u$ to $v$.
References
- Brandes, U.: A faster algorithm for betweenness centrality. J Math Sociol 25 (2001) 163-177