de.jstacs.algorithms.graphs
Class Edge
java.lang.Object
de.jstacs.algorithms.graphs.Edge
- All Implemented Interfaces:
- Cloneable, Comparable<Edge>
public class Edge
- extends Object
- implements Comparable<Edge>, Cloneable
This class is a representation of a weighted edge.
- Author:
- Jens Keilwagen
Field Summary |
protected int |
source
The source node. |
protected int |
target
The target node. |
protected double |
weight
the weight. |
Constructor Summary |
Edge(int s,
int t,
double w)
|
source
protected int source
- The source node.
target
protected int target
- The target node.
weight
protected double weight
- the weight.
Edge
public Edge(int s,
int t,
double w)
throws IllegalArgumentException
- Parameters:
s
- the start nodet
- the target (=end) nodew
- the weight
- Throws:
IllegalArgumentException
- if the names of the nodes are less than 0
getStartNode
public int getStartNode()
- Returns:
- the start node
getEndNode
public int getEndNode()
- Returns:
- the end node
getWeight
public double getWeight()
- Returns:
- the weight of the edge
toString
public String toString()
- Overrides:
toString
in class Object
compareTo
public int compareTo(Edge e)
throws ClassCastException
- Specified by:
compareTo
in interface Comparable<Edge>
- Throws:
ClassCastException
clone
public Edge clone()
- Overrides:
clone
in class Object