Compute the shortest-path betweenness centrality for nodes.
Betweenness centrality of a node
v
v
v is the sum of the
fraction of all-pairs shortest paths that pass through
v
v
v
c
B
(
v
)
=
∑
s
,
t
∈
V
σ
(
s
,
t
∣
v
)
σ
(
s
,
t
)
c_B(v) =\sum_{s,t \in V} \frac{\sigma(s, t|v)}{\sigma(s, t)}
cB(v)=s,t∈V∑σ(s,t)σ(s,t∣v)
where
V
V
V is the set of nodes,
σ
(
s
,
t
)
\sigma(s, t)
σ(s,t) is the number of shortest
(
s
,
t
)
(s, t)
(s,t)-paths,
and
σ
(
s
,
t
∣
v
)
\sigma(s, t|v)
σ(s,t∣v) is the number of those paths passing through some node
v
v
v other than
s
,
t
s, t
s,t.
If
s
=
t
s = t
s=t,
σ
(
s
,
t
)
=
1
\sigma(s, t) = 1
σ(s,t)=1,
and if
v
∈
s
,
t
v \in {s, t}
v∈s,t,
σ
(
s
,
t
∣
v
)
=
0
\sigma(s, t|v) = 0
σ(s,t∣v)=0