Boost logo

Boost :

Subject: Re: [boost] [BGL] To customize the graph traversing
From: Dmitry Bufistov (dmitry_at_[hidden])
Date: 2009-07-15 05:58:41

Hi Cosimo,

Cosimo Calabrese wrote:
> Hi to all,
> I'm studying the BGL, and I've a question. I've noticed that:
> - the traversing algorithms, like breadth first search, only decide how
> to traverse the graph, but do not perform specific calculations;
> - if I want to perform any calculation during the traverse, I can do it
> passing a custom visitor to the algorithm.
> But the question is: how can I customize the traverse method? The
> algorithms always explore enterely the graph.
> The solution I found is to modify the breadth_first_search algorithm,
> adding a predicate to the visitor and performing a control when the
> algorithm examines the outer edges of the current vertex. Something like
> this:
[A possible solution]
> Does it exist a better mechanism to control the traverse with the BGL?
> Or I must implement my solution?
> Best Regards,
> Cosimo Calabrese.

You also may try to use filtered graph adaptor


Boost list run by bdawes at, gregod at, cpdaniel at, john at