|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.SingleSourceShortestPaths | +--com.mhhe.clrs2e.BellmanFord
Implementation of the Bellman-Ford algorithm on page 588 of Introduction to Algorithms, Second edition.
Field Summary |
Fields inherited from class com.mhhe.clrs2e.SingleSourceShortestPaths |
g, noNegWeightCycle |
Constructor Summary | |
BellmanFord(com.mhhe.clrs2e.WeightedAdjacencyListGraph theGraph)
Sets up the instance variables, including allocation of the spInfo array but not allocation of the
ShortestPathInfo objects referenced by the array. |
Method Summary | |
void |
computeShortestPaths(com.mhhe.clrs2e.Vertex s)
Computes single-source shortest paths from a given source vertex, filling in weights and predecessors in the spInfo array. |
Methods inherited from class com.mhhe.clrs2e.SingleSourceShortestPaths |
getShortestPathInfo, getShortestPathInfo, hasNoNegativeWeightCycle, initializeSingleSource, newShortestPathInfo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BellmanFord(com.mhhe.clrs2e.WeightedAdjacencyListGraph theGraph)
spInfo
array but not allocation of the
ShortestPathInfo
objects referenced by the array.
(That's SingleSourceShortestPaths.initializeSingleSource(com.mhhe.clrs2e.Vertex)
's job.)
theGraph
- The graph for which we are computing
single-source shortest paths.Method Detail |
public void computeShortestPaths(com.mhhe.clrs2e.Vertex s)
spInfo
array. Also sets the instance variable
noNegWeightCycle
appropriately.
computeShortestPaths
in class SingleSourceShortestPaths
s
- The source vertex.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |