Subject: Re: [boost] [BGL] Testing a graph for bipartiteness
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-03-05 12:45:19
On Fri, 5 Mar 2010, Matthias Walter wrote:
> On 03/04/10 23:40, Jeremiah Willcock wrote:
>> On Thu, 4 Mar 2010, Matthias Walter wrote:
>>>> That makes sense. Maybe you want your visitor to be a wrapper
>>>> around an
>>>> arbitrary visitor, though? I.e., you would call the nested visitor on
>>>> all event points, even those you don't handle.
>>> I must admin that I don't really understand, what you mean. Around what
>>> other visitor shall I wrap it? Or shall I split the current visitor into
>>> more smaller ones which wrap each other somehow?
>> I mean that your visitor takes another arbitrary visitor as a template
>> parameter, stores it, and then invokes its methods after you run your
>> hooks. Basically, it's a generalization of what you do now with
>> predecessor recorders but working with any visitor.
> I experimented with some solutions and don't really like the
> hook-calling by hand. As you seem to like something really generic, I
> finally decided to go with the VisitorEventList, i.e. I split the
> functionality into bipartition_colorize, bipartiton_check and
> property_put functors which are then thrown together in the DFS call.
> The latter might be worth including into visitors.hpp, I think: It takes
> a property map plus a value of it and just sets the value when called. I
> use this to initialize the start vertex to be white, but it doesn't
> require the property map to be a color map and can work on vertices and
> edges and thus all possible visitors. But this is up to you to move it
> to visitors.hpp if you like it.
I put it in visitors.hpp and added documentation in
libs/graph/doc/property_put.html; please see what you think of it.
-- Jeremiah Willcock