How to make custom property map compatible with bgl_named_params?
I have a custom (internal) property map defined as: struct edge_weight_extractor_map { typedef float8 value_type; typedef float8 reference; typedef WeightedEdgeTableSQLGraph::edge_descriptor key_type; typedef boost::readable_property_map_tag category; }; inline edge_weight_extractor_map::value_type get(const edge_weight_extractor_map& map, const edge_weight_extractor_map::key_type& key) { return key.edge_weight; } The map works fine as an internal property map with eg dijkstra_shortest_paths. However, I cannot get it to work when it is used in a bgl_named_params expression like: boost::brandes_betweenness_centrality(g, centrality, boost::weight_map(get(boost::edge_weight, g))); The error looks like: /usr/include/boost/property_map.hpp:25: error: no type named 'key_type' in 'struct boost::bgl_named_params<edge_weight_extractor_map, boost::edge_weight_t, boost::no_property>' /usr/include/boost/property_map.hpp:27: error: no type named 'reference' in 'struct boost::bgl_named_params<edge_weight_extractor_map, boost::edge_weight_t, boost::no_property>' /usr/include/boost/property_map.hpp:28: error: no type named 'category' in 'struct boost::bgl_named_params<edge_weight_extractor_map, boost::edge_weight_t, boost::no_property>' Do I need to specialize a traits template? Can someone post an example of how this works? (I've tried to specialize bgl_named_params itself, but unsuccessfully.) Thanks. THK -- Timothy H. Keitt http://www.keittlab.org/
On Sun, Nov 23, 2008 at 4:40 PM, Tim Keitt <tkeitt@keittlab.org> wrote:
I have a custom (internal) property map defined as: .......
boost::brandes_betweenness_centrality(g, centrality, boost::weight_map(get(boost::edge_weight, g)));
Oh bother. This was very simple. Unlike nearly every other algorithm in the Graph library, this one is called with all or none named parameters (except for the graph itself): boost::brandes_betweenness_centrality(g, boost::centrality_map(centrality).weight_map(get(boost::edge_weight, g))); works fine. Sigh. THK -- Timothy H. Keitt http://www.keittlab.org/
participants (1)
-
Tim Keitt