next up previous contents index
Next: Adjacency Iterators for leaving Up: Graphs and Iterators Previous: Node Iterators ( NodeIt

     
Edge Iterators ( EdgeIt )

Definition

a variable it of class EdgeIt is a linear edge iterator that iterates over the edge set of a graph; the current edge of an iterator object is said to be ``marked'' by this object.

#include < LEDA/graph _iterator.h >

Creation

EdgeIt it introduces a variable it of this class associated with no graph.
EdgeIt it(graph G) introduces a variable it of this class associated with G and marked with G.first_edge().
EdgeIt it(graph G, edge e) introduces a variable it of this class marked with e and associated with G. Precondition: e is an edge of G.

Operations

void  it.init(graph G) associates it with G and marks it with G.first_edge().
void  it.init(graph G, edge e) associates it with G and marks it with e.
void  it.update(edge e) it marks e afterwards.
void  it.reset() resets it to G.first_edge() where G is the associated graph.
void  it.reset_end() resets it to G.last_edge() where G is the associated graph.
void  it.make_invalid() makes it invalid, i.e. it.valid() will be false afterwards and it marks no node.
void  it.insert(node v1, node v2)
    creates a new edge from v1 to v2 and it marks it afterwards.
void  it.del() deletes the marked edge, i.e. it.valid() returns false afterwards. Precondition: it.valid() returns true.
EdgeIt& it = it2 assigns it2 to it. This method returns a reference to it.
bool it == it2 returns true if and only if it and it2 are equal, i.e. if the marked edges are equal.
bool it.eol() returns !it.valid() which is true if and only if there is no successor edge left, i.e. if all edges leaving the marked node are passed (eol: end of list).
bool it.valid() returns true if and only if end of sequence not yet passed, i.e. if there is an edge leaving the marked node that was not yet passed.
edge  it.get_edge() returns the marked edge or nil if it.valid() returns false.
graph it.get_graph() returns the associated graph.
EdgeIt& ++it performs one step forward in the list of edges of the associated graph. If there is no successor edge, it.eol() will be true afterwards. This method returns a reference to it. Precondition: it.valid() returns true.
EdgeIt& -it performs one step backward in the list of edges of the associated graph. If there is no predecessor edge, it.eol() will be true afterwards. This method returns a reference to it. Precondition: it.valid() returns true.

Implementation

Creation of an iterator and all methods take constant time.


next up previous contents index
Next: Adjacency Iterators for leaving Up: Graphs and Iterators Previous: Node Iterators ( NodeIt
LEDA research project
1999-04-23