public class DirectedEdge
extends java.lang.Object
DirectedEdge
class represents a weighted edge in an
EdgeWeightedDigraph
. Each edge consists of two integers
(naming the two vertices) and a real-value weight. The data type
provides methods for accessing the two endpoints of the directed edge and
the weight.
For additional documentation, see Section 4.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Modifier and Type | Field and Description |
---|---|
Meeting |
caracteristic |
Constructor and Description |
---|
DirectedEdge(int v,
int w,
double weight)
Initializes a directed edge from vertex
v to vertex w with
the given weight . |
DirectedEdge(int v,
int w,
double weight,
Meeting edge_caracteristics) |
DirectedEdge(int v,
int w,
Meeting edge_caracteristics) |
Modifier and Type | Method and Description |
---|---|
Meeting |
caracteristic() |
int |
from()
Returns the tail vertex of the directed edge.
|
double |
id() |
DirectedEdge |
reverse() |
void |
setEdge_caracteristic(Meeting edge_caracteristic) |
void |
setweight(double aweight) |
int |
to()
Returns the head vertex of the directed edge.
|
java.lang.String |
toString()
Returns a string representation of the directed edge.
|
double |
weight()
Returns the weight of the directed edge.
|
public Meeting caracteristic
public DirectedEdge(int v, int w, double weight)
v
to vertex w
with
the given weight
.v
- the tail vertexw
- the head vertexweight
- the weight of the directed edgejava.lang.IndexOutOfBoundsException
- if either v
or w
is a negative integerjava.lang.IllegalArgumentException
- if weight
is NaN
public DirectedEdge(int v, int w, Meeting edge_caracteristics)
public DirectedEdge(int v, int w, double weight, Meeting edge_caracteristics)
public double id()
public int from()
public int to()
public double weight()
public void setweight(double aweight)
public void setEdge_caracteristic(Meeting edge_caracteristic)
public Meeting caracteristic()
public java.lang.String toString()
toString
in class java.lang.Object
public DirectedEdge reverse()