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 _iterator.h >

Creation

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

EdgeIt it(leda_graph G) introduces a variable it of this class associated with G and marked with G.first_edge().

EdgeIt it(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(leda_graph G) associates it with G and marks it with G.first_edge().

void it.init(leda_graph G, 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 = 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.

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

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
LEDA research project
2000-02-09