org.neo4j.graphalgo.impl.centrality
Class BetweennessCentrality<ShortestPathCostType>
java.lang.Object
org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality<Double,ShortestPathCostType>
org.neo4j.graphalgo.impl.centrality.BetweennessCentrality<ShortestPathCostType>
- Type Parameters:
ShortestPathCostType - The datatype used by the underlying
SingleSourceShortestPath algorithm, i.e. the type the edge
weights are represented by.
public class BetweennessCentrality<ShortestPathCostType>
- extends ShortestPathBasedCentrality<Double,ShortestPathCostType>
Class for computing betweenness centrality as defined by Linton C. Freeman
(1977) using the algorithm by Ulrik Brandes (2001).
- Author:
- Patrik Larsson
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
globalFactor
protected Double globalFactor
BetweennessCentrality
public BetweennessCentrality(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
Set<Node> nodeSet)
- Default constructor.
- Parameters:
singleSourceShortestPath - Underlying singleSourceShortestPath.nodeSet - A set containing the nodes for which centrality values should
be computed.
reset
public void reset()
- Description copied from class:
ShortestPathBasedCentrality
- The calculation is normally only done once, this resets it so it can be
run again. Also used locally for initialization.
- Overrides:
reset in class ShortestPathBasedCentrality<Double,ShortestPathCostType>
getAndUpdateNodeDependency
protected Double getAndUpdateNodeDependency(Node node,
boolean skipFirstNode,
Map<Node,List<Relationship>> successors,
Util.PathCounter counter,
Map<Node,Double> dependencies)
- This recursively updates the node dependencies
- Parameters:
node - The start nodeskipFirstNode - If true, the start node is not updated. Useful, since the
first node in any path doesnt need to be updated.successors - counter - Object that can return the number of paths from the initial
start node to any node.dependencies - A map used to limit the recursion where possible (dynamic
programming)
- Returns:
processShortestPaths
public void processShortestPaths(Node node,
SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath)
- Description copied from class:
ShortestPathBasedCentrality
- This is the abstract method all centrality algorithms based on this class
need to implement. It is called once for every node in the node set,
along with a SingleSourceShortestPath starting in that node.
- Specified by:
processShortestPaths in class ShortestPathBasedCentrality<Double,ShortestPathCostType>
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.