V
- the graph vertex typeE
- the graph edge typepublic class BetweennessCentrality<V,E> extends Object implements VertexScoringAlgorithm<V,Double>
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
Constructor and Description |
---|
BetweennessCentrality(Graph<V,E> graph)
Construct a new instance.
|
BetweennessCentrality(Graph<V,E> graph,
boolean normalize)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
Map<V,Double> |
getScores()
Get a map with the scores of all vertices
|
Double |
getVertexScore(V v)
Get a vertex score
|
public BetweennessCentrality(Graph<V,E> graph)
graph
- the input graphpublic Map<V,Double> getScores()
getScores
in interface VertexScoringAlgorithm<V,Double>
public Double getVertexScore(V v)
getVertexScore
in interface VertexScoringAlgorithm<V,Double>
v
- the vertexCopyright © 2019. All rights reserved.