org.neo4j.graphalgo.impl.centrality
Class StressCentrality<ShortestPathCostType>
java.lang.Object
org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality<Double,ShortestPathCostType>
org.neo4j.graphalgo.impl.centrality.StressCentrality<ShortestPathCostType>
- Type Parameters:
ShortestPathCostType - The datatype used by the underlying
SingleSourceShortestPath algorithm, i.e. the type the edge
weights are represented by.
public class StressCentrality<ShortestPathCostType>
- extends ShortestPathBasedCentrality<Double,ShortestPathCostType>
Implementation of stress centrality, which is defined as the number of
shortest paths going through each node.
- 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
StressCentrality
public StressCentrality(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>
getAndUpdateNodeStress
protected Double getAndUpdateNodeStress(Node node,
boolean skipFirstNode,
Map<Node,List<Relationship>> successors,
Util.PathCounter counter,
Map<Node,Double> stresses)
- This recursively updates the node stress (number of paths through a
node).
- 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.stresses - 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.