|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- The vertices in the graph.public static interface UndirectedGraph.Edge<V>
A possible edge connecting two vertices of an underlying UndirectedGraph. The edge denoted by this object must not necessarily exist in the graph--use edge.exists() to check.
This is a convenience object mainly used for iterators, which can return it as a tuple of two vertices. To avoid creating a huge amount of objects, implementors are encouraged to let iterators always return the same edge on a call to iterator.next(), but with updated vertices. Note that this means that a user has to use edge.clone() if he wants an edge independent of the iterator.
The methods should simply call the appropriate methods of the underlying graph.
UndirectedGraph
Method Summary | |
---|---|
UndirectedGraph.Edge<V> |
clone()
Clones this edge. |
boolean |
exists()
Checks if this edge exists in the graph. |
V |
getVertexA()
Returns one vertex of this edge. |
V |
getVertexB()
Returns the other vertex of this edge (not the one returned be getVertexA()). |
double |
getWeight()
Returns the weight of this edge. |
boolean |
isConnectedTo(V vertex)
Checks if this edge is directly connected to a vertex. |
double |
remove()
Removes this edge. |
double |
setWeight(double weight)
Sets the weight of this edge. |
Method Detail |
---|
V getVertexA()
getVertexB()
V getVertexB()
getVertexA()
boolean isConnectedTo(V vertex) throws java.lang.NullPointerException
vertex
- the vertex.
java.lang.NullPointerException
- if the vertex is null.getVertexA()
,
getVertexB()
boolean exists() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if at least one of the vertices was
removed from the graph.UndirectedGraph.containsEdge(Object, Object)
double setWeight(double weight) throws java.util.NoSuchElementException
Sets the weight of this edge. This should always be the same as calling undirectedGraph.setEdgeWeight(Object, Object, double) using the two vertices of this edge as parameter.
Setting the weight to the value returned by undirectedGraph.getUnconnectedWeight() should be the same as calling edge.remove().
weight
- the new weight of the edge.
java.util.NoSuchElementException
- if at least one of the two vertices is
not a part of the graph any more.exists()
,
remove()
,
UndirectedGraph.getUnconnectedWeight()
,
UndirectedGraph.setEdgeWeight(Object, Object, double)
double remove() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- If at least one of the two vertices is
not a part of the graph any more.exists()
,
setWeight(double)
,
UndirectedGraph.getUnconnectedWeight()
,
UndirectedGraph.setEdgeWeight(Object, Object, double)
double getWeight() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- If at least one of the vertices was
removed from the graph.exists()
,
UndirectedGraph.getUnconnectedWeight()
,
UndirectedGraph.getEdgeWeight(Object, Object)
UndirectedGraph.Edge<V> clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |