lu.cs.co.graph
Class Edges
java.lang.Object
|
+--lu.cs.co.graph.Edges
- public class Edges
- extends Object
An iterator over a set of edges. Objects of this class generate
edges one at a time. Successive calls to the next method return
successive edges from the set.
The canonical way to
process the edges of graph G is as follows:
for (Edges E= G.edges(); E.hasNext(); )
{ Edge e= E.next();
handle(e);
}
|
Method Summary |
boolean |
hasNext()
Returns true if there are any edges left. |
Edge |
next()
Returns the next edge. |
hasNext
public boolean hasNext()
- Returns true if there are any edges left. In other words,
calling next would return an edge instead of throwing an
exception.
- Returns:
- true if the iterator has more elements
next
public Edge next()
- Returns the next edge.
- Returns:
- the next edge
- Throws:
- NoSuchElementException - if there are no edges left