Package algs43
Class Edge
java.lang.Object
algs43.Edge
- All Implemented Interfaces:
- Comparable<Edge>
The 
Edge class represents a weighted edge in an undirected graph.
  For additional documentation, see Section 4.3 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionEdge(int v, int w, double weight) Create an edge between v and w with given weight.
- 
Method SummaryModifier and TypeMethodDescriptionintCompare edges by weight.inteither()Return either endpoint of this edge.static voidTest client.intother(int vertex) Return the endpoint of this edge that is different from the given vertex (unless a self-loop).toString()Return a string representation of this edge.doubleweight()Return the weight of this edge.
- 
Field Details- 
v
- 
w
- 
weight
 
- 
- 
Constructor Details- 
EdgeCreate an edge between v and w with given weight.
 
- 
- 
Method Details- 
weightReturn the weight of this edge.
- 
eitherReturn either endpoint of this edge.
- 
otherReturn the endpoint of this edge that is different from the given vertex (unless a self-loop).
- 
compareToCompare edges by weight.- Specified by:
- compareToin interface- Comparable<Edge>
 
- 
toStringReturn a string representation of this edge.
- 
mainTest client.
 
-