Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Filtered_graph edgepredicate
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-04-27 13:29:52


On Mon, 26 Apr 2010, Line Blander Reinhardt wrote:

> Hi all
> I need to make a filtered graph for each color.
> I have a graph where the edges are assigned a color (there are many colours).
>
> I want to make a filtered graph (for each colour) given a colour.
> I am a little lost with the filtered graph and edge predicates and do not know how to make one with a colour and a colour-edge map.
> In the examples I have found it is only the map that is needed in the edgepredicate.
> I have made something like ...
>
> template <typename Colour, typename EdgeColourMap >
> struct same_edge_colour {
> same_edge_colour(): t_colour(){ }
> same_edge_colour(Colour a, EdgeColourMap m) : t_colour(a),m_colours(m){ }
> template <typename Edge>
> bool operator()(const Edge& e) const {
> return boost::get(m_colours,e)==t_colour;
> }
> Tag t_colour;
> EdgeAgentMap m_colours;
> };
>
> I am not able to make my filter and the filtered graph.
> Can someone help me?? Tell me if you need more information.

Do you just need to turn a color map into an edge predicate? In that
case, you might just want to copy-and-paste the definition of
property_map_filter (from boost/graph/filtered_graph.hpp) and edit it to
check the edge's color.

-- Jeremiah Willcock


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