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
Hi! You only need one template argument: the color map. The other types (color and edge descriptor) can be deduced from the property map: template <typename EdgeColourMap> struct same_edge_colour { same_edge_colour(): t_colour(){ } same_edge_colour(typename EdgeColourMap::value_type a, EdgeColourMap m) : t_colour(a),m_colours(m){ } bool operator()(const typename EdgeColourMap::key_type& e) const { return boost::get(m_colours,e)==t_colour; } typename EdgeColourMap::value_type t_colour; EdgeColourMap m_colours; }; Cheers, Gabe
Thanks a bunch for your help Line ________________________________________ Fra: boost-users-bounces@lists.boost.org [boost-users-bounces@lists.boost.org] På vegne af Gábor Szuromi [kukkerman@gmail.com] Sendt: 27. april 2010 02:00 Til: boost-users@lists.boost.org Emne: Re: [Boost-users] [BGL] Filtered_graph edgepredicate Hi! You only need one template argument: the color map. The other types (color and edge descriptor) can be deduced from the property map: template <typename EdgeColourMap> struct same_edge_colour { same_edge_colour(): t_colour(){ } same_edge_colour(typename EdgeColourMap::value_type a, EdgeColourMap m) : t_colour(a),m_colours(m){ } bool operator()(const typename EdgeColourMap::key_type& e) const { return boost::get(m_colours,e)==t_colour; } typename EdgeColourMap::value_type t_colour; EdgeColourMap m_colours; }; Cheers, Gabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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
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
participants (3)
-
Gábor Szuromi
-
Jeremiah Willcock
-
Line Blander Reinhardt