Boost logo

Boost :

Subject: Re: [boost] [BGL] on using visitor in dijkstra_shortest_path
From: Sandeep Gupta (gupta.sandeep_at_[hidden])
Date: 2009-07-02 12:31:40


Thanks Andrew. I changed the name and that error is now gone but I am still
having difficulty in defining visitor function:
As I understand the visitor's argument should model "Dijkstra Visitor".
Hence i created
record_predecessor which is derived from dijkstra_visitor and therefore I
assume would model "Dijkstra Visitor".

After this I made following call
 vector<vertex_t> p(num_vertices(gg));
record_predecessor<vector<vertex_t> > rp(p);
dijkstra_shortest_paths(gg, src,
predecessor_map(preds).weight_map(weights).distance_map(dists).visitor(rp));

But this isn't legal. Please let me know what am i missing.

I also tried using the record_predecessors method of visitor as following:
vector<vertex_t> p(num_vertices(gg));
dijkstra_shortest_paths(gg, src, dijkstra_shortest_paths(gg, src,
predecessor_map(preds).weight_map(weights).distance_map(dists).visitor(make_dijkstra_visitor(record_predecessors(p,
on_edge_relaxed()))));
But this doesn't seem to work as well. The full code is available at
http://codepad.org/98AovhZO . Attached below are the errors.

*/home/sandeep/Computing/boost_sandbox/boost-trunk/boost/graph/named_function_params.hpp:112:
error: field
‘boost::bgl_named_params<boost::associative_property_map<std::map<boost::detail::edge_desc_impl<boost::bidirectional_tag,
unsigned int>, int,
std::less<boost::detail::edge_desc_impl<boost::bidirectional_tag, unsigned
int> >, std::allocator<std::pair<const
boost::detail::edge_desc_impl<boost::bidirectional_tag, unsigned int>, int>
> > > ()(int), boost::edge_weight_t,
boost::bgl_named_params<boost::associative_property_map<std::map<unsigned
int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<const
unsigned int, unsigned int> > > >, boost::vertex_predecessor_t,
boost::no_property> >::m_value’ invalidly declared function type*

*/home/sandeep/Computing/boost_sandbox/boost-trunk/boost/graph/dijkstra_shortest_paths.hpp:473:
error: no matching function for call to ‘get_param(const
boost::bgl_named_params<boost::dijkstra_visitor<boost::predecessor_recorder<std::vector<unsigned
int, std::allocator<unsigned int> >, boost::on_edge_relaxed> >,
boost::graph_visitor_t,
boost::bgl_named_params<boost::associative_property_map<std::map<unsigned
int, int, std::less<unsigned int>, std::allocator<std::pair<const unsigned
int, int> > > >, boost::vertex_distance_t,
boost::bgl_named_params<boost::associative_property_map<std::map<boost::detail::edge_desc_impl<boost::bidirectional_tag,
unsigned int>, int,
std::less<boost::detail::edge_desc_impl<boost::bidirectional_tag, unsigned
int> >, std::allocator<std::pair<const
boost::detail::edge_desc_impl<boost::bidirectional_tag, unsigned int>, int>
> > > ()(int), boost::edge_weight_t,
boost::bgl_named_params<boost::associative_property_map<std::map<unsigned
int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<const
unsigned int, unsigned int> > > >, boost::vertex_predecessor_t,
boost::no_property> > > >&, boost::edge_weight_t)’*

thanks
sandeep


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk