Class BetweennessCentrality<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.scoring.BetweennessCentrality<V,E>
-
- All Implemented Interfaces:
EdgeScorer<E,java.lang.Double>,VertexScorer<V,java.lang.Double>
public class BetweennessCentrality<V,E> extends java.lang.Object implements VertexScorer<V,java.lang.Double>, EdgeScorer<E,java.lang.Double>
Computes betweenness centrality for each vertex and edge in the graph.- See Also:
- "Ulrik Brandes: A Faster Algorithm for Betweenness Centrality. Journal of Mathematical Sociology 25(2):163-177, 2001."
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classBetweennessCentrality.BetweennessComparatorprivate classBetweennessCentrality.BetweennessData
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<E,java.lang.Double>edge_scoresprotected Graph<V,E>graphprotected java.util.Map<V,BetweennessCentrality.BetweennessData>vertex_dataprotected java.util.Map<V,java.lang.Double>vertex_scores
-
Constructor Summary
Constructors Constructor Description BetweennessCentrality(Graph<V,E> graph)Calculates betweenness scores based on the all-pairs unweighted shortest paths in the graph.BetweennessCentrality(Graph<V,E> graph, com.google.common.base.Function<? super E,? extends java.lang.Number> edge_weights)Calculates betweenness scores based on the all-pairs weighted shortest paths in the graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeBetweenness(java.util.Queue<V> queue, com.google.common.base.Function<? super E,? extends java.lang.Number> edge_weights)java.lang.DoublegetEdgeScore(E e)java.lang.DoublegetVertexScore(V v)protected voidinitialize(Graph<V,E> graph)
-
-
-
Constructor Detail
-
BetweennessCentrality
public BetweennessCentrality(Graph<V,E> graph)
Calculates betweenness scores based on the all-pairs unweighted shortest paths in the graph.- Parameters:
graph- the graph for which the scores are to be calculated
-
BetweennessCentrality
public BetweennessCentrality(Graph<V,E> graph, com.google.common.base.Function<? super E,? extends java.lang.Number> edge_weights)
Calculates betweenness scores based on the all-pairs weighted shortest paths in the graph.NOTE: This version of the algorithm may not work correctly on all graphs; we're still working out the bugs. Use at your own risk.
- Parameters:
graph- the graph for which the scores are to be calculatededge_weights- the edge weights to be used in the path length calculations
-
-
Method Detail
-
computeBetweenness
protected void computeBetweenness(java.util.Queue<V> queue, com.google.common.base.Function<? super E,? extends java.lang.Number> edge_weights)
-
getVertexScore
public java.lang.Double getVertexScore(V v)
- Specified by:
getVertexScorein interfaceVertexScorer<V,E>- Parameters:
v- the vertex whose score is requested- Returns:
- the algorithm's score for this vertex
-
getEdgeScore
public java.lang.Double getEdgeScore(E e)
- Specified by:
getEdgeScorein interfaceEdgeScorer<V,E>- Parameters:
e- the edge whose score is requested- Returns:
- the algorithm's score for this edge
-
-