Package repast.simphony.space.graph
Class ShortestPath<T>
- java.lang.Object
-
- repast.simphony.space.graph.ShortestPath<T>
-
- All Implemented Interfaces:
ProjectionListener<T>
public class ShortestPath<T> extends Object implements ProjectionListener<T>
Calculates the shortest path from a specified node to all other nodes in the net using Dijkstra's algorithm.- Version:
- $Revision$ $Date$
- Author:
- Nick Collier, Eric Tatara
-
-
Constructor Summary
Constructors Constructor Description ShortestPath()
ConstructorShortestPath(Network<T> net)
ShortestPath(Network<T> net, T source)
Deprecated.As of release 1.2, replaced by#ShortestPath(Network
net)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
finalize()
Removes this as a projection listener when this ShortestPath is garbage collected.static ShortestPath
finished(ShortestPath<?> sp)
Null the object so that the Garbage Collector recognizes to remove the object from the jvm.List<RepastEdge<T>>
getPath(T source, T target)
Returns a list of RepastEdges in the shortest path from source to target.double
getPathLength(T target)
Deprecated.As of release 1.2, replaced by#getPathLength(T source, T target)
double
getPathLength(T source, T target)
Gets the path length from the source node to the target node.void
projectionEventOccurred(ProjectionEvent<T> evt)
Called when the network is modified so that this will recalculate the shortest path info.
-
-
-
Constructor Detail
-
ShortestPath
public ShortestPath()
Constructor- Parameters:
net
- the Network
-
ShortestPath
@Deprecated public ShortestPath(Network<T> net, T source)
Deprecated.As of release 1.2, replaced by#ShortestPath(Network
net) Creates shortest path info from the specified source to all other nodes in the specified network.- Parameters:
net
- the networksource
- the source node
-
-
Method Detail
-
getPath
public List<RepastEdge<T>> getPath(T source, T target)
Returns a list of RepastEdges in the shortest path from source to target.- Parameters:
source
-target
-- Returns:
-
getPathLength
public double getPathLength(T source, T target)
Gets the path length from the source node to the target node.- Parameters:
source
- the node we want to get the path length fromtarget
- the node we want to get the path length to- Returns:
- the path length from the source node to the target node.
-
getPathLength
@Deprecated public double getPathLength(T target)
Deprecated.As of release 1.2, replaced by#getPathLength(T source, T target)
Gets the path length from the source node specified in the constructor to the target node.- Parameters:
target
- the node we want to get the path length to- Returns:
- the path length from the source node to the target node.
-
projectionEventOccurred
public void projectionEventOccurred(ProjectionEvent<T> evt)
Called when the network is modified so that this will recalculate the shortest path info.- Specified by:
projectionEventOccurred
in interfaceProjectionListener<T>
- Parameters:
evt
-
-
finalize
public void finalize()
Removes this as a projection listener when this ShortestPath is garbage collected.
-
finished
public static ShortestPath finished(ShortestPath<?> sp)
Null the object so that the Garbage Collector recognizes to remove the object from the jvm.
-
-