org.neo4j.graphalgo.impl.centrality
Class ClosenessCentrality<ShortestPathCostType>
java.lang.Object
org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>
org.neo4j.graphalgo.impl.centrality.ClosenessCentrality<ShortestPathCostType>
- Type Parameters:
ShortestPathCostType - The datatype used by the underlying
SingleSourceShortestPath algorithm, i.e. the type the edge
weights are represented by.
public class ClosenessCentrality<ShortestPathCostType>
- extends ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>
Implementation of closeness centrality, which can be seen as the "average"
distance from every node to all other nodes.
- Author:
- Patrik Larsson
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClosenessCentrality
public ClosenessCentrality(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
CostAccumulator<ShortestPathCostType> centralityAccumulator,
ShortestPathCostType zeroValue,
Set<Node> nodeSet,
CostDivider<ShortestPathCostType> centralityDivider)
- Default constructor.
- Parameters:
singleSourceShortestPath - Underlying singleSourceShortestPath.centralityAccumulator - Object capable of adding distances. Needed since an "average"
will be computed.zeroValue - Default value and starting value to the accumulator.nodeSet - A set containing the nodes for which centrality values should
be computed.centralityDivider - An object capable of inverting a distance.
getCentrality
public ShortestPathCostType getCentrality(Node node)
- Description copied from class:
ShortestPathBasedCentrality
- This can be used to retrieve the result for every node. Will return null
if the node is not contained in the node set initially given.
- Overrides:
getCentrality in class ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>
- 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<ShortestPathCostType,ShortestPathCostType>
Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.