org.jgrapht.alg.scoring

## Class BetweennessCentrality<V,E>

• Type Parameters:
V - the graph vertex type
E - the graph edge type
All Implemented Interfaces:
VertexScoringAlgorithm<V,Double>

public class BetweennessCentrality<V,E>
extends Object
implements VertexScoringAlgorithm<V,Double>
Betweenness centrality.

Computes the betweenness centrality of each vertex of a graph. The betweenness centrality of a node $v$ is given by the expression: $g(v)= \sum_{s \neq v \neq t}\frac{\sigma_{st}(v)}{\sigma_{st}}$ where $\sigma_{st}$ is the total number of shortest paths from node $s$ to node $t$ and $\sigma_{st}(v)$ is the number of those paths that pass through $v$. For more details see wikipedia. The algorithm is based on

• Brandes, Ulrik (2001). "A faster algorithm for betweenness centrality". Journal of Mathematical Sociology. 25 (2): 163–177.
• ### Method Detail

• #### getScores

public Map<V,Double> getScores()
Get a map with the scores of all vertices
Specified by:
getScores in interface VertexScoringAlgorithm<V,Double>
Returns:
a map with all scores
• #### getVertexScore

public Double getVertexScore(V v)
Get a vertex score
Specified by:
getVertexScore in interface VertexScoringAlgorithm<V,Double>
Parameters:
v - the vertex
Returns:
the score