next up previous contents index
Next: Adjacency Iterators for leaving Up: Graphs and Iterators Previous: Edge Iterators ( EdgeIt   Contents   Index


Face Iterators ( FaceIt )

Definition

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

Precondition: Before using any face iterator the list of faces has to be computed by calling G.compute_faces(). Note, that any update operation invalidates this list.

#include < LEDA/graph/graph_iterator.h >

Creation

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

FaceIt it(const leda::graph& G) introduces a variable it of this class associated with G.

The graph is initialized by G. The face is initialized by G.first_face().

FaceIt it(const leda::graph& G, leda::face n)
    introduces a variable it of this class marked with n and associated with G.

Precondition: n is a face of G.

Operations

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

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

void it.reset() resets it to G.first_face(), 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 face.

void it.reset_end() resets it to G.last_face(), where G is the associated graph.

void it.update(leda::face n) it marks n afterwards.

FaceIt& it = const FaceIt& it2 it is afterwards associated with the same graph and face as it2. This method returns a reference to it.

bool it == const FaceIt& it2 returns true if and only if it and it2 are equal, i.e. if the marked faces are equal.

leda::face it.get_face() returns the marked face or nil if it.valid() returns false.

const leda::graph& it.get_graph() returns the associated graph.

bool it.valid() returns true if and only if end of sequence not yet passed, i.e. if there is a face in the face set that was not yet passed.

bool it.eol() returns !it.valid() which is true if and only if there is no successor face left, i.e. if all faces of the face set are passed (eol: end of list).

FaceIt& ++it performs one step forward in the list of faces of the associated graph. If there is no successor face, it.eol() will be true afterwards. This method returns a reference to it.

Precondition: it.valid() returns true.

FaceIt& -it performs one step backward in the list of faces of the associated graph. If there is no predecessor face, 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: Edge Iterators ( EdgeIt   Contents   Index