Boost logo

Boost Users :

Subject: [Boost-users] problem with boost parallel graph dijkstra_shortest_paths
From: areslp (areslp_at_[hidden])
Date: 2012-07-20 02:04:15


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


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