|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality<CentralityType,ShortestPathCostType>
CentralityType - The result datatype. Values of this is stored for every node and
accumulated during calculation.ShortestPathCostType - The datatype used by the SingleSourceShortestPath to represent
path weights.public abstract class ShortestPathBasedCentrality<CentralityType,ShortestPathCostType>
This serves as a base class for all centrality algorithms based on shortest paths. All these algorithms make use of the SingleSourceShortestPath object to calculate the shortest paths which can be adapted for the kind of graph to run the calculation on and set up with proper calculation limits. The main purpose of this class, except containing everything common to these algorithms, is to open up for parallel computation of several of these algorithms at the same time. This could be made possible by reusing the SingleSourceShortestPath computation made for every node.
| Field Summary | |
|---|---|
protected Map<Node,CentralityType> |
centralities
This map over centrality values is made available to the algorithms inheriting this class. |
protected CostAccumulator<CentralityType> |
centralityAccumulator
|
protected boolean |
doneCalculation
|
protected Set<Node> |
nodeSet
|
protected SingleSourceShortestPath<ShortestPathCostType> |
singleSourceShortestPath
|
protected CentralityType |
zeroValue
|
| Constructor Summary | |
|---|---|
ShortestPathBasedCentrality(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
CostAccumulator<CentralityType> centralityAccumulator,
CentralityType zeroValue,
Set<Node> nodeSet)
Default constructor. |
|
| Method Summary | |
|---|---|
protected void |
addCentralityToNode(Node node,
CentralityType value)
This adds a value to a given node in the centralities Map. |
void |
calculate()
Runs the calculation. |
CentralityType |
getCentrality(Node node)
This can be used to retrieve the result for every node. |
abstract void |
processShortestPaths(Node node,
SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath)
This is the abstract method all centrality algorithms based on this class need to implement. |
void |
reset()
The calculation is normally only done once, this resets it so it can be run again. |
protected void |
setCentralityForNode(Node node,
CentralityType value)
This sets a value for a given node in the centralities Map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath
protected CostAccumulator<CentralityType> centralityAccumulator
protected CentralityType zeroValue
protected Set<Node> nodeSet
protected boolean doneCalculation
protected Map<Node,CentralityType> centralities
| Constructor Detail |
|---|
public ShortestPathBasedCentrality(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
CostAccumulator<CentralityType> centralityAccumulator,
CentralityType zeroValue,
Set<Node> nodeSet)
singleSourceShortestPath - The underlying shortest path algorithm.centralityAccumulator - When centralities are built through sums, this makes it
possible to call addCentralityToNode several times, which then
uses this object to add values together.zeroValue - The default value to start with.nodeSet - The set of nodes values should be stored for.| Method Detail |
|---|
public void reset()
protected void addCentralityToNode(Node node,
CentralityType value)
node - value -
protected void setCentralityForNode(Node node,
CentralityType value)
node - value - public CentralityType getCentrality(Node node)
node -
public void calculate()
public abstract void processShortestPaths(Node node,
SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath)
node - singleSourceShortestPath -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||