$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [Graph] Difference between DF search and visit / Graph Printing
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-03-26 11:18:02
On 03/26/11 09:54, Marcus Riemer wrote:
[snip]
>> Are you trying to print all paths from the root of the tree to leaves?
>> That's a little bit harder problem, I think.
> Its actually quite easy to solve recursively. I have just done it for
> LEDA and I guess porting the code to boost is a snap. Basicly I just
> couldn't believe that I have to roll out my own solution.
> 
> As a reference here is what I mocked up for LEDA:
> void LedaPrecedenceDiagram::recursivePrint(VertexDescriptor entry, int
> depth)
> {
>     // Apply depth
>     for (int i = 0; i < depth; i++ )
>     {
>         std::cout << ".";
>     }
>     
>     // Print name and depth
>     std::cout << mGraph[entry]->getName()
>               << " (" <<  mGraph[entry]->getDuration() << ")" << std::endl;
>     
Marcus,
You might find:
as a replacement for '// Apply depth'.  The depth is stored in a derived
streambuf and incremented and decremented with the indent_buf_in
and indent_buf_out iomanipulators; hence, you don't have
to pass the depth as an argument.  A demo is here:
and docs are here:
http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/iostreams/doc/functions/
HTH.
-Larry