Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Switching from depth_first_search to depth_first_visit
From: Marcus Riemer (Marcus_at_[hidden])
Date: 2011-03-16 09:33:34


Hello there!

I just stumbled over a little bug that is simply due to the wrong
visiting pattern used. From what I understand it should simply print a
graph with children being indented.

The visitor defined for the task itself is just fine. Problem is that
currently a depth first *search* is used, which prints each vertex only
once.

So from my understanding the only thing I need to do is to replace that
search with a visit. Sadly replacing the call to depth_first_visit with
a call to depth_first_visit is not as easy as I thought ...

For the record: The search call itself looks like this:
boost::depth_first_search(mGraph,
boost::visitor(printer).root_vertex(start));

Looking at the documentation [0] it seems that there is no version with
named parameters for the depth first visit. So I need to pass the graph
itself, the starting vertex, the visitor and a color map.

And its the color map that troubles me ... I have tried around a little
to construct such a thing, but so far without success. My try can be
found at [1]. This results in a massive compilation error [2].

I am not really experienced with the extent templates are used in the
BGL and have no idea what the compiler tries to tell me.

Could anyone give me a hint what I am doing wrong?

If more sourcecode is required thats not a problem at all. Simply tell
me if anything is missing. Access to the source is also not a problem,
compilation is quite easy using cmake.

Thanks in advance
   Marcus Riemer

[0]
http://www.boost.org/doc/libs/1_44_0/libs/graph/doc/depth_first_visit.html
[1] http://pastebin.com/ALvnTdj9
[2] http://pastebin.com/bh6d4NpH


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net