next up previous contents index
Next: Face Iterators ( FaceIt Up: Graphs and Iterators Previous: Node Iterators ( NodeIt   Contents   Index


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/graph_iterator.h >

Creation

EdgeIt it introduces a variable it of this class associated with no graph.

EdgeIt it(const leda::graph& G) introduces a variable it of this class associated with G and marked with G.first_edge().

EdgeIt it(const leda::graph& G, leda::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(const leda::graph& G)
    associates it with G and marks it with G.first_edge().

void it.init(const leda::graph& G, const leda::edge& e)
    associates it with G and marks it with e.

void it.update(leda::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(leda::node v1, leda::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 = const EdgeIt& it2 assigns it2 to it. This method returns a reference to it.

bool it == const EdgeIt& 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.

leda::edge it.get_edge() returns the marked edge or nil if it.valid() returns false.

const leda::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: Face Iterators ( FaceIt Up: Graphs and Iterators Previous: Node Iterators ( NodeIt   Contents   Index
root 2008-01-09