next up previous index
Next: pathExists and shortestPathLength Up: Shortest Paths in Weighted Previous: The basic algorithm   Index


Shortest path methods

The PositiveWeightedGraph class provides three public methods:

public boolean pathExists(Object origin, Object destination);
public int shortestPathLength(Object origin, Object destination);
public Enumeration shortestPath(Object origin, Object destination);
Each of these calls the basic dijkstra method in Figure 13.3 which determines the shortest paths, and their lengths, to every node reachable from origin.



Subsections

Peter Williams 2005-06-07