Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Difference between DF search and visit / Graph Printing
From: Marcus Riemer (Marcus_at_[hidden])
Date: 2011-03-26 07:13:15


Hi there!

I am struggling a little understanding the difference between the DF
search and visit. I thought that the DF visit would revisit "back" nodes
while the DF search would not. But as I just found out that does seem to
be the difference.

What I want:
I would like to print all following nodes for every node of a acylic
graph. Lets say I have this very simple graph, I hope spaces are preserved:

        -> Long \
Begin / -> End
       \ ->
        -> Short /

I would like to print that graph in the following Fashion:

Begin
.Long
..End
.Short
..End

I don't mind the exact order of "Long" and "Short", as long as they are
both printed.

So far I did this by implementing the following dfs_visitor<> [0].

I then apply the visitor with a call to boost::depth_first_visit() and
my graph. However, the problem is, that the "End" node is only visited,
and therefore printed, once.

Of course I could roll out the DF visit myself, but as I will be
demonstrating this at my unversity, I would prefer a clean solution.

So what am I probably missing to print the graph in the fasion I want it?

[0] http://pastebin.com/u43TtU7F


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