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.

Initialization of get queue() with all nodes of type OutAdjIt::nodetype that have zero<br />

indegree, i.e. get(indeg,it)==indeg.value null.<br />

while ( !algorithm.finished() ) {<br />

// do something reasonable with algo.current()<br />

algo.next();<br />

}<br />

<strong>The</strong> source code of function toposort count() is implemented according to this pattern<br />

and may serve as a concrete example.<br />

13.20 Strongly Connected Components (flexible) (<br />

GIT SCC )<br />

1. Definition<br />

An instance algorithm of class GIT SCC < Out, In, It, OutSt, InSt, NSt, Mark > is an<br />

implementation of an algorithm that computes the strongly connected components.<br />

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

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

graph is allowed at creation time. Method compnumb() returns the component number of<br />

the current node.<br />

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

2. Creation<br />

GIT SCC < Out, In, It, OutSt, InSt, NSt, Mark ><br />

algorithm(OutSt ost, InSt ist, Mark ma, Out oai, const It& it, In iai);<br />

Preconditions:<br />

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

and data accessor ma.<br />

• Out is an adjacency iterator that iterates over the outgoing edges of a fixed vertex<br />

• In is an adjacency iterator that iterates over the incoming edges of a fixed vertex<br />

• OutSt is stack parameterized with items of type Out<br />

• InSt is stack parameterized with items of type In

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

Saved successfully!

Ooh no, something went wrong!