dijkstra and associative property map

Hi, Attached below is the code to call Dijkstra over property_map data structures. The current definition of associative property map is incompatible for dijkstra. Somehow there is mismatch with respect to operator[]. Attach below is the code and the error. std::map<vertex_t, vertex_t> pred; boost::associative_property_map< std::map<vertex_t, vertex_t> > preds(pred); std::map<vertex_t, double> dist; boost::associative_property_map< std::map<vertex_t, double> > dists(dist); std::map<vertex_t, double> weight; boost::associative_property_map< std::map<vertex_t, double> > weights(weight); vertex_t v; //vertex_t v1 = preds[v]; dijkstra_shortest_paths(tg, v, predecessor_map(preds). weight_map(weights). distance_map(dists) ); Error: /home/sandeep/Computing/boost_1_38_0/boost/property_map.hpp:314: error: no match for ‘operator[]’ in ‘(const boost::associative_property_map<std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > > >&)((const boost::associative_property_map<std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > > >*)(& pa))[k]’ /home/sandeep/Computing/boost_1_38_0/boost/property_map.hpp:458: note: candidates are: typename UniquePairAssociativeContainer::value_type::second_type& boost::associative_property_map<UniquePairAssociativeContainer>::operator[](const typename UniquePairAssociativeContainer::key_type&) const [with UniquePairAssociativeContainer = std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > >] Thanks sandeep

Pls. Ignore the mail. The error due to a typo. Thanks sandeep On Thu, Mar 26, 2009 at 3:57 PM, Sandeep Gupta <gupta.sandeep@gmail.com> wrote:
Hi, Attached below is the code to call Dijkstra over property_map data structures. The current definition of associative property map is incompatible for dijkstra. Somehow there is mismatch with respect to operator[]. Attach below is the code and the error.
std::map<vertex_t, vertex_t> pred; boost::associative_property_map< std::map<vertex_t, vertex_t> > preds(pred);
std::map<vertex_t, double> dist; boost::associative_property_map< std::map<vertex_t, double> > dists(dist);
std::map<vertex_t, double> weight; boost::associative_property_map< std::map<vertex_t, double> > weights(weight);
vertex_t v; //vertex_t v1 = preds[v]; dijkstra_shortest_paths(tg, v, predecessor_map(preds). weight_map(weights). distance_map(dists) );
Error: /home/sandeep/Computing/boost_1_38_0/boost/property_map.hpp:314: error: no match for ‘operator[]’ in ‘(const boost::associative_property_map<std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > > >&)((const boost::associative_property_map<std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > > >*)(& pa))[k]’ /home/sandeep/Computing/boost_1_38_0/boost/property_map.hpp:458: note: candidates are: typename UniquePairAssociativeContainer::value_type::second_type& boost::associative_property_map<UniquePairAssociativeContainer>::operator[](const typename UniquePairAssociativeContainer::key_type&) const [with UniquePairAssociativeContainer = std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, double> > >]
Thanks sandeep
participants (1)
-
Sandeep Gupta