Package repast.simphony.space.graph
Class ShortestPath<T>
java.lang.Object
repast.simphony.space.graph.ShortestPath<T>
- All Implemented Interfaces:
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
ConstructorDescriptionConstructorShortestPath
(Network<T> net) ShortestPath
(Network<T> net, T source) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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>>
Returns a list of RepastEdges in the shortest path from source to target.double
getPathLength
(T target) Deprecated.As of release 1.2, replaced bygetPathLength(T source, T target)
double
getPathLength
(T source, T target) Gets the path length from the source node to the target node.void
Called when the network is modified so that this will recalculate the shortest path info.
-
Constructor Details
-
ShortestPath
public ShortestPath()Constructor- Parameters:
net
- the Network
-
ShortestPath
-
ShortestPath
Deprecated.As of release 1.2, replaced byShortestPath(Network<T> 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 Details
-
getPath
Returns a list of RepastEdges in the shortest path from source to target.- Parameters:
source
-target
-- Returns:
-
getPathLength
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.As of release 1.2, replaced bygetPathLength(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
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
Null the object so that the Garbage Collector recognizes to remove the object from the jvm.
-
ShortestPath(Network<T> net)