org.neo4j.graphalgo.impl.centrality
Class NetworkDiameter<ShortestPathCostType>

java.lang.Object
  extended by org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>
      extended by org.neo4j.graphalgo.impl.centrality.NetworkDiameter<ShortestPathCostType>

public class NetworkDiameter<ShortestPathCostType>
extends ShortestPathBasedCentrality<ShortestPathCostType,ShortestPathCostType>

This can be used to calculate the diameter of a network, which is defined as the largest eccentricity of all the nodes in the network.

Author:
Patrik Larsson

Field Summary
protected  ShortestPathCostType diameter
           
protected  Eccentricity<ShortestPathCostType> eccentricity
           
 
Fields inherited from class org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality
centralities, centralityAccumulator, doneCalculation, nodeSet, singleSourceShortestPath, zeroValue
 
Constructor Summary
NetworkDiameter(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath, ShortestPathCostType zeroValue, Set<Node> nodeSet, Comparator<ShortestPathCostType> distanceComparator)
          Default constructor.
 
Method Summary
 ShortestPathCostType getCentrality(Node node)
          This can be used to retrieve the result for every node.
 void processShortestPaths(Node node, SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath)
          This is the abstract method all centrality algorithms based on this class need to implement.
 
Methods inherited from class org.neo4j.graphalgo.impl.centrality.ShortestPathBasedCentrality
addCentralityToNode, calculate, reset, setCentralityForNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eccentricity

protected Eccentricity<ShortestPathCostType> eccentricity

diameter

protected ShortestPathCostType diameter
Constructor Detail

NetworkDiameter

public NetworkDiameter(SingleSourceShortestPath<ShortestPathCostType> singleSourceShortestPath,
                       ShortestPathCostType zeroValue,
                       Set<Node> nodeSet,
                       Comparator<ShortestPathCostType> distanceComparator)
Default constructor.

Parameters:
singleSourceShortestPath - Underlying singleSourceShortestPath.
zeroValue - Default value.
nodeSet - A set containing the nodes for which centrality values should be computed.
distanceComparator - Object being able to compare eccentricity values (path distances), in order to sort out the largest.
Method Detail

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>

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:


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.