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.

3. dfs grow depth: a new adjacency iterator was appended to the stack because it<br />

was detected as not seen before, i.e. the treewalk goes in depth-direction<br />

4. dfs grow breadth: the former current adjacency iterator was replaced by the successor<br />

iterator, i.e. the treewalk goes in breadth-direction<br />

Iterator version: <strong>The</strong>re is an iterator version of this algorithm: DFS It. Usage is similar<br />

to that of node iterators without the ability to go backward in the sequence.<br />

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

2. Creation<br />

GIT DFS< OutAdjIt, Stacktype, Mark ><br />

algorithm(const Stacktype& st, Mark& ma);<br />

Preconditions:<br />

creates an instance algorithm of this class bound to the stack st<br />

and data accessor ma.<br />

• Stacktype is a stack parameterized with items of type OutAdjIt.<br />

• st contains the sources of the traversal (for each source node an adjacency iterator<br />

referring to it) and<br />

• ma is a data accessor that provides read and write access to a boolean value for<br />

each node (accessed through iterators). This value is assumed to be freely usable<br />

by algorithm.<br />

GIT DFS< OutAdjIt, Stacktype, Mark ><br />

algorithm(const Stacktype& st, Mark& ma, const OutAdjIt& ai);<br />

creates an instance algorithm of this class bound to the stack st,<br />

data accessor ma and the adjacency iterator ai representing the<br />

source node of the depth first traversal.<br />

3. Operations<br />

void algorithm.next unseen( )<br />

Performs one iteration of the core loop of the algorithm<br />

for one unseen node of the graph.<br />

dfs return algorithm.next( ) Performs one iteration of the core loop of the algorithm.<br />

OutAdjIt algorithm.current( ) returns the “current” iterator.

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

Saved successfully!

Ooh no, something went wrong!