|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.ShortestPathInfo
Class for information determined about a vertex during a shortest-path algorithm.
Field Summary | |
private double |
d
The current shortest-path estimate for this vertex. |
private com.mhhe.clrs2e.Vertex |
pi
The current predecessor (parent) for this vertex. |
Constructor Summary | |
ShortestPathInfo()
Initializes the shortest-path estimate to infinity and the predecessor to null . |
Method Summary | |
double |
getEstimate()
Returns the shortest-path estimate. |
com.mhhe.clrs2e.Vertex |
getPredecessor()
Returns the predecessor. |
boolean |
relax(com.mhhe.clrs2e.Vertex u,
double du,
double w)
Relaxes an edge entering this vertex, say v , based
on the Relax procedure on page 586 of Introduction to
Algorithms, Second edition. |
void |
setEstimate(double newEstimate)
Sets the shortest-path estimate. |
void |
setPredecessor(com.mhhe.clrs2e.Vertex v)
Sets the predecessor. |
java.lang.String |
toString()
Returns the String representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private double d
private com.mhhe.clrs2e.Vertex pi
Constructor Detail |
public ShortestPathInfo()
null
.
Method Detail |
public void setEstimate(double newEstimate)
newEstimate
- The new shortest-path estimate.public double getEstimate()
public void setPredecessor(com.mhhe.clrs2e.Vertex v)
v
- The new predecessor.public com.mhhe.clrs2e.Vertex getPredecessor()
public boolean relax(com.mhhe.clrs2e.Vertex u, double du, double w)
v
, based
on the Relax procedure on page 586 of Introduction to
Algorithms, Second edition.
u
- Vertex that the edge leaves.du
- u
's shortest-path estimate.w
- The weight of the edge (u,v).
true
if the shortest-path estimate for
v
changes, false
if the shortest-path
estimate remains unchanged.public java.lang.String toString()
String
representation of this object.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |