31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In addition to the algorithm mentioned earlier this wrapper writes the internal states to<br />

the standard output.<br />

This is as efficient as rewriting the “Algorithm”-class with an output mechanism, but<br />

provides more flexibility.<br />

13.2 Node Iterators ( NodeIt )<br />

1. Definition<br />

a variable it of class NodeIt is a linear node iterator that iterates over the node set of a<br />

graph; the current node of an iterator object is said to be “marked” by this object.<br />

#include < <strong>LEDA</strong>/graph/graph iterator.h ><br />

2. Creation<br />

NodeIt it;<br />

introduces a variable it of this class associated with no graph.<br />

NodeIt it(const leda :: graph& G);<br />

introduces a variable it of this class associated with G.<br />

<strong>The</strong> graph is initialized by G. <strong>The</strong> node is initialized by<br />

G.first node( ).<br />

NodeIt it(const leda :: graph& G, leda :: node n);<br />

3. Operations<br />

void it.init(const leda :: graph& G)<br />

introduces a variable it of this class marked with n and associated<br />

with G.<br />

Precondition: n is a node of G.<br />

associates it with G and marks it with G.first node( ).<br />

void it.init(const leda :: graph& G, const leda :: node& v)<br />

associates it with G and marks it with v.<br />

void it.reset( ) resets it to G.first node( ), where G is the associated<br />

graph.<br />

void it.make invalid( ) makes it invalid, i.e. it.valid( ) will be false afterwards<br />

and it marks no node.<br />

void it.reset end( ) resets it to G.last node( ), where G is the associated<br />

graph.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!