|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WeightedGraph
An interface for weighted graphs. For more discussion of the structure and use of this interface, see the Graph interface. The return value of getWeight() may be a "sentinel" value that indicates the requested edge is absent from the graph. Typical sentinels include positive or negative infinity, zero, or NaN. Classes that implement this interface should specify what sentinel value they use, or allow the user to choose their own sentinel. Note that any of these methods may throw an IndexOutOfBoundsException if any of the input vertex IDs are out of bounds.
Method Summary | |
---|---|
boolean |
addEdge(int begin,
int end,
double weight)
Adds a weighted edge between two vertices. |
double |
getWeight(int begin,
int end)
Gets the weight of the edge between two vertices. |
double |
missingEdgeSentinel()
Returns the "sentinel" weight value for edges not in the graph. |
boolean |
setWeight(int begin,
int end,
double weight)
Sets the weight of an edge already in the graph. |
Methods inherited from interface Graph |
---|
addVertex, clear, getDegree, getInDegree, getNeighbors, hasEdge, isDirected, isEmpty, numEdges, numVerts |
Method Detail |
---|
boolean addEdge(int begin, int end, double weight)
boolean setWeight(int begin, int end, double weight)
double getWeight(int begin, int end)
double missingEdgeSentinel()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |