|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface UndirectedLongGraph.Edge
A possible edge connecting two vertices of an underlying
UndirectedLongGraph
. The edge denoted by this object must not
necessarily exist in the graph -- use 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.
Method Summary | |
---|---|
UndirectedLongGraph.Edge |
clone()
Clones this edge. |
boolean |
exists()
Checks if this edge exists in the graph. |
long |
getVertexA()
Returns one vertex of this edge. |
long |
getVertexB()
Returns the other vertex of this edge (not the one returned be getVertexA()). |
double |
getWeight()
Returns the weight of this edge. |
boolean |
isConnectedTo(long vertex)
Check if this edge is directly connected to a certain vertex. |
double |
remove()
Removes this edge. |
double |
setWeight(double weight)
Sets the weight of this edge. |
Method Detail |
---|
long getVertexA()
getVertexB()
long getVertexB()
getVertexA()
boolean isConnectedTo(long vertex)
vertex
- the vertex.
getVertexA()
,
getVertexB()
boolean exists() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if at least one of the vertices was
removed from the graph.UndirectedLongGraph.containsEdge(long, long)
double setWeight(double weight) throws java.util.NoSuchElementException
Sets the weight of this edge. This should always be the same as calling undirectedLongGraph.setEdgeWeight(long, long, double) using the two vertices of this edge as parameter.
Setting the weight to the value returned by undirectedLongGraph.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()
,
UndirectedLongGraph.getUnconnectedWeight()
,
UndirectedLongGraph.setEdgeWeight(long, long, 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)
,
UndirectedLongGraph.getUnconnectedWeight()
,
UndirectedLongGraph.setEdgeWeight(long, long, double)
double getWeight() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if at least one of the vertices was
removed from the graph.exists()
,
UndirectedLongGraph.getEdgeWeight(long, long)
,
UndirectedLongGraph.getUnconnectedWeight()
UndirectedLongGraph.Edge clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |