Compute the shortest-path betweenness centrality for nodes.
Betweenness centrality of a node vvv is the sum of the
fraction of all-pairs shortest paths that pass through vvv
cB(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
VVV 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 vvv other than s,ts, ts,t.
If s=ts = ts=t, σ(s,t)=1\sigma(s, t) = 1σ(s,t)=1,
and if v∈s,tv \in {s, t}v∈s,t,σ(s,t∣v)=0\sigma(s, t|v) = 0σ(s,t∣v)=0