Boost logo

Boost :

Subject: Re: [boost] [BGL] Testing a graph for bipartiteness
From: Matthias Walter (xammy_at_[hidden])
Date: 2010-03-05 08:49:08


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 updated the archive at Boost Vault.

best regards
Matthias Walter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk