org.jscience.computing.graph.algorithms
Class DijkstraShortestPath

java.lang.Object
  extended by org.jscience.computing.graph.algorithms.DijkstraShortestPath

public final class DijkstraShortestPath
extends java.lang.Object

An implementation of Dijkstra's shortest path algorithm using ClosestFirstIterator.

Since:
Sep 2, 2003

Constructor Summary
DijkstraShortestPath(Graph graph, java.lang.Object startVertex, java.lang.Object endVertex, double radius)
          Creates and executes a new DijkstraShortestPath algorithm instance.
 
Method Summary
static java.util.List findPathBetween(Graph graph, java.lang.Object startVertex, java.lang.Object endVertex)
          Convenience method to find the shortest path via a single static method call.
 java.util.List getPathEdgeList()
          Return the edges making up the path found.
 double getPathLength()
          Return the length of the path found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DijkstraShortestPath

public DijkstraShortestPath(Graph graph,
                            java.lang.Object startVertex,
                            java.lang.Object endVertex,
                            double radius)
Creates and executes a new DijkstraShortestPath algorithm instance. An instance is only good for a single search; after construction, it can be accessed to retrieve information about the path found.

Parameters:
graph - the graph to be searched
startVertex - the vertex at which the path should start
endVertex - the vertex at which the path should end
radius - limit on path length, or Double.POSITIVE_INFINITY for unbounded search
Method Detail

getPathEdgeList

public java.util.List getPathEdgeList()
Return the edges making up the path found.

Returns:
List of Edges, or null if no path exists

getPathLength

public double getPathLength()
Return the length of the path found.

Returns:
path length, or Double.POSITIVE_INFINITY if no path exists

findPathBetween

public static java.util.List findPathBetween(Graph graph,
                                             java.lang.Object startVertex,
                                             java.lang.Object endVertex)
Convenience method to find the shortest path via a single static method call. If you need a more advanced search (e.g. limited by radius, or computation of the path length), use the constructor instead.

Parameters:
graph - the graph to be searched
startVertex - the vertex at which the path should start
endVertex - the vertex at which the path should end
Returns:
List of Edges, or null if no path exists