cs132.dijkstra
Class ShortestPath<E>

java.lang.Object
  extended by cs132.dijkstra.ShortestPath<E>

public class ShortestPath<E>
extends java.lang.Object

Perform Dijkstra's algorithm over a weighted, directed graph.


Constructor Summary
ShortestPath(E start, EdgeModel<E> model)
          Perform a shorted path computation.
 
Method Summary
 int getMinimumCost(E w)
          Return the cost of the minimum cost path from the start element to the designated element.
 java.util.List<? extends E> getMinimumCostPath(E w)
          Return the path from the start element to the designated element, inclusive.
 java.util.Set<E> reachable()
          Return the set of elements reachable from the start element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShortestPath

public ShortestPath(E start,
                    EdgeModel<E> model)
Perform a shorted path computation.

Parameters:
start - Starting element
model - An edge model that provides the successor of each element and the cost from any element to any other element.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMinimumCost

public int getMinimumCost(E w)
Return the cost of the minimum cost path from the start element to the designated element.

Parameters:
w -
Returns:
cost

reachable

public java.util.Set<E> reachable()
Return the set of elements reachable from the start element.


getMinimumCostPath

public java.util.List<? extends E> getMinimumCostPath(E w)
Return the path from the start element to the designated element, inclusive. The first element should always be the start element, and the last element of the returned list should be the element supplied as a parameter.

Parameters:
w - element to which path is desired
Returns:
path from start element to w


Web Accessibility