problem with boost parallel graph dijkstra_shortest_paths

I want to use the parallel version of dijkstra_shortest_paths, here is my code, it works very well with the sequential version of BGL, but can not be compiled with parallel BGL. typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::property < boost::edge_weight_t, double > > graph_t; typedef boost::graph_traits < graph_t >::vertex_descriptor vertex_descriptor; typedef boost::graph_traits < graph_t >::edge_descriptor edge_descriptor; typedef std::pair<int, int> Edge; template <class Vertex> struct target_visitor : public default_dijkstra_visitor { target_visitor(vector<bool>* vec,int total) : vec_(vec),num_(0),total_(total),examined_(0) { } template <class Graph> void examine_vertex(Vertex v, Graph& g) { examined_++; if ((*vec_)[v]) { //visited, set false to prevent multi visit (*vec_)[v]=false; num_++; //cout<<"v:"<<v<<",total:"<<total_<<",num:"<<num_<<",examined_:"<<examined_<<endl; } if (total_==num_) { //cout<<"OK. break, Total point size is:"<<vec_->size()<<",examined_ point size is:"<<examined_<<endl; //all vertex in v have been found throw std::exception(); } } private: vector<bool>* vec_; int num_; int total_; int examined_; }; template <class Vertex> target_visitor<Vertex> target_visit(vector<bool>* u,int total) { return target_visitor<Vertex>(u,total); } void BaseFilter::getShortestPathInNRing(int source,int num,std::vector<bool>& tar,std::vector<vertex_descriptor>& p,std::vector<double>& d){ vertex_descriptor sou = vertex(source, g_); assert(num_vertices(g_)==mesh_->m_vecVertex.size()); property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g_); property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index, g_); try { dijkstra_shortest_paths(g_, sou, &p[0], &d[0], weightmap, indexmap, std::less<double>(), closed_plus<double>(), (std::numeric_limits<double>::max)(), 0, target_visitor<vertex_descriptor>(&tar,num)); //dijkstra_shortest_paths(g_, sou, predecessor_map(&p[0]).distance_map(&d[0])); } catch (std::exception e) { } } The compile errors are: Error 11 error C2664: 'boost::put' : cannot convert parameter 2 from 'boost::detail::parallel::global_descriptor<LocalDescriptor>' to 'ptrdiff_t' C:\boost_1_49_0\boost_1_49_0\boost\graph\distributed\crauser_et_al_shortest_paths.hpp 584 Error 12 error C2664: 'boost::put' : cannot convert parameter 2 from 'boost::detail::parallel::global_descriptor<LocalDescriptor>' to 'ptrdiff_t' C:\boost_1_49_0\boost_1_49_0\boost\graph\distributed\crauser_et_al_shortest_paths.hpp 585 Error 13 error C2664: 'boost::put' : cannot convert parameter 2 from 'boost::detail::parallel::global_descriptor<LocalDescriptor>' to 'ptrdiff_t' C:\boost_1_49_0\boost_1_49_0\boost\graph\distributed\crauser_et_al_shortest_paths.hpp 587 -- Best Regards Areslp

On 20/07/2012 07:04, areslp wrote:
I want to use the parallel version of dijkstra_shortest_paths, here is my code, it works very well with the sequential version of BGL, but can not be compiled with parallel BGL.
dijkstra_shortest_paths(g_, sou, &p[0], &d[0], ...
Using pointers as property maps does not always seem to work (for me). Maybe it will help making an iterator_property_map for the vectors p and d. typedef std::vector<vertex_descriptor>::iterator p_iter; typedef std::vector<double>::iterator d_iter; typedef typed_identity_property_map<size_t> id_map; iterator_property_map< p_iter, id_map > pmap(p.begin(), id_map() ); iterator_property_map< d_iter, id_map > dmap(d.begin(), id_map() ); dijkstra_shortest_paths(g_, sou, pmap, dmap,... This may not be the problem, but it does not hurt either. Best, Alex
participants (2)
-
Alex Hagen-Zanker
-
areslp