Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] Type "VertexIndexMap"
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-10-02 15:17:26


On Fri, 2 Oct 2009, Alexandre Bos wrote:

> Hello,
>
> I am trying to create an instance of edmonds_augmenting_path_finder :
>
> --------- test.cpp ---------
> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/max_cardinality_matching.hpp>
> using namespace std;
> using namespace boost;
>
> typedef adjacency_list<vecS, vecS, undirectedS> custom_graph;
>
> [...]
>
> typedef std::vector<graph_traits<custom_graph>::vertex_descriptor>
> matemap_t;
> matemap_t mate(42);
> custom_graph g(42);
> edmonds_augmenting_path_finder<custom_graph, matemap_t,
> property_map<custom_graph, vertex_index_t>::type > augmentator(g, mate,
> get(vertex_index, g));
>
> [...]
> ---------------------------
>
> The compiler (g++) returns the following error :
>
> /.../max_cardinality_matching.hpp: In constructor
> 'boost::edmonds_augmenting_path_finder<Graph, MateMap,
> VertexIndexMap>::edmonds_augmenting_path_finder(const Graph&, MateMap,
> VertexIndexMap) [with Graph = boost::adjacency_list<boost::vecS,
> boost::vecS, boost::undirectedS, boost::no_property, boost::no_property,
> boost::no_property, boost::listS>, MateMap = std::vector<long unsigned
> int, std::allocator<long unsigned int> >, VertexIndexMap =
> boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>]':
> /.../convert.cpp:102: instantiated from here
> /.../max_cardinality_matching.hpp:190: error: no matching function for
> call to 'get(std::vector<long unsigned int, std::allocator<long unsigned
> int> >&, const long unsigned int&)'
>
> How can I fix this ?

A raw vector is not usable as a property map for BGL. Use the
iterator_property_map adaptor in Boost.PropertyMap instead; that can take
the begin iterator of your vector and convert it into an appropriate
property map to pass to BGL algorithms.

-- 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