public class Edge extends Object implements Comparable<Edge>, Cloneable
Modifier and Type | Field and Description |
---|---|
protected int |
source
The source node.
|
protected int |
target
The target node.
|
protected double |
weight
The weight of the edge.
|
Constructor and Description |
---|
Edge(int s,
int t,
double w)
Creates a new weighted edge.
|
Modifier and Type | Method and Description |
---|---|
Edge |
clone() |
int |
compareTo(Edge e) |
int |
getEndNode()
Returns the end node of the edge.
|
int |
getStartNode()
Returns the start node of the edge.
|
double |
getWeight()
Returns the weight of the edge.
|
String |
toString() |
protected int source
protected int target
protected double weight
public Edge(int s, int t, double w) throws IllegalArgumentException
s
- the start nodet
- the target (=end) nodew
- the weight of the edgeIllegalArgumentException
- if the names of the nodes are less than 0public int getStartNode()
public int getEndNode()
public double getWeight()
public int compareTo(Edge e) throws ClassCastException
compareTo
in interface Comparable<Edge>
ClassCastException