org._3pq.jgrapht
public interface Edge extends java.lang.Cloneable
NOTE: the source and target associations of an Edge must be immutable after construction for all implementations. The reason is that once an Edge is added to a Graph, the Graph representation may be optimized via internal indexing data structures; if the Edge associations were to change, these structures would be corrupted. However, other properties of an edge (such as weight or label) may be mutable, although this still requires caution: changes to Edges shared by multiple Graphs may not always be desired, and indexing mechanisms for these properties may require a change notification mechanism.
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_EDGE_WEIGHT
The default weight for an edge.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates and returns a shallow copy of this edge.
|
boolean |
containsVertex(java.lang.Object v)
Returns true if this edge contains the specified vertex.
|
java.lang.Object |
getSource()
Returns the source vertex of this edge.
|
java.lang.Object |
getTarget()
Returns the target vertex of this edge.
|
double |
getWeight()
Returns the weight of this edge.
|
java.lang.Object |
oppositeVertex(java.lang.Object v)
Returns the vertex opposite to the specified vertex.
|
void |
setWeight(double weight)
Sets the weight of this edge.
|
static final double DEFAULT_EDGE_WEIGHT
java.lang.Object getSource()
java.lang.Object getTarget()
void setWeight(double weight)
UnsupportedOperationException
is thrown.weight
- new weight.java.lang.UnsupportedOperationException
- if this edge is unweighted.double getWeight()
1.0
is returned.java.lang.Object clone()
Cloneable
boolean containsVertex(java.lang.Object v)
this.getSource().equals(v) || this.getTarget().equals(v)
v
- vertex whose presence in this edge is to be tested.java.lang.Object oppositeVertex(java.lang.Object v)
v
- the vertex whose opposite is required.java.lang.IllegalArgumentException
- if v is neither the source nor the
target vertices of this edge.java.lang.NullPointerException
- if v is null
.