Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL: cutting subgraph using more than one condition.
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-10-28 08:29:51


>
> Remover<weight_map_type> r(get(edge_weight, graphMST), Wthr );
> remove_edge_if(r, graphMST);
>
> Is it possible to define instead of Wthr to define an array of properties?
> What is the proper way to do it?
>

Sure, but the best answer really depends on what you're trying to do. If
you're looking to pass an arbitrary array of thresholds, then you could just
construct the functor over a reference to a vector or array.

If you're trying to associate each edge? vertex? with a threshold, then you
could do one of two things. You could basically take the direct approach (as
above) and construct the functor over a reference to a vector or
unordered_map (depending on the properties of your graph). Alternatively,
you could construct the functor over a /property map/, which abstracts the
read/write operations to a container (vector or hash table) defined
elsewhere in your program. See the BGL documentation about exterior
properties. It's light, but it'll get you started in the right direction.

Either of the two cases is appropriate. If you plan on reusing your functor
in a generic context, I would use the second approach.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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