Class 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 Detail

      • ShortestPath

        public ShortestPath()
        Constructor
        Parameters:
        net - the Network
      • ShortestPath

        public ShortestPath​(Network<T> net)
      • 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 network
        source - 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 from
        target - 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.
      • finalize

        public void finalize()
        Removes this as a projection listener when this ShortestPath is garbage collected.
        Overrides:
        finalize in class Object
      • finished

        public static ShortestPath finished​(ShortestPath<?> sp)
        Null the object so that the Garbage Collector recognizes to remove the object from the jvm.