Help needed to implement D_shortest_path
Hi Dear all, Sorry for disturbing, i hope you can help me because i am facing one problem i tried a lot but i can not succeeded. To find the directed path between two nodes. First i tried to implement Depth First Search but it is searching the verteces even there is no edge exist. so, now i want to implement dijkstra_shortest_path , it is giving errors. Please guide me how i can implement this method. code is : slGraph& graph = this->pBN->get_graph(); slNode n = vertex(2, graph); std::vector<slNode> p(num_vertices(graph)); std::vector<int> d(num_vertices(graph)); boost::property_map<slGraph, edge_weight_t>::type weightMap = get(edge_weight, graph); boost::property_map<slGraph, vertex_index_t>::type indexmap = get(vertex_index, graph); dijkstra_shortest_paths(graph, n, predecessor_map(&p[0]).distance_map(&d[0])); // First pattern to implement //dijkstra_shortest_paths(graph, n, &p[0], &d[0], weightMap, indexmap, // std::less<int>(), closed_plus<int>(), // second pattern // (std::numeric_limits<int>::max)(), 0, // default_dijkstra_visitor()); ============================================ errors ============================================================== 1>c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(251) : error C2664: 'void put<int,DistInf>(T *,ptrdiff_t,const V &)' : cannot convert parameter 2 from 'void *' to 'ptrdiff_t' 1> with 1> [ 1> DistInf=int, 1> T=int, 1> V=int 1> ] 1> There is no context in which this conversion is possible 1> c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(292) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths<VertexListGraph,boost::dijkstra_visitor<>,void**__w64 ,DistanceMap,WeightMap,IndexMap,std::less<_Ty>,boost::closed_plus<T>,int,int,ColorMap>(const VertexListGraph &,void *,PredecessorMap,DistanceMap,WeightMap,IndexMap,Compare,Combine,DistInf,DistZero,DijkstraVisitor,ColorMap)' being compiled 1> with 1> [ 1> VertexListGraph=slGraph, 1> DistanceMap=int *__w64 , 1> WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,long double,const long double &,void *,const boost::property<boost::edge_weight_t,slScoreValueType>,boost::edge_weight_t>, 1> IndexMap=boost::adj_list_vertex_property_map<slGraph,unsigned int,const unsigned int &,boost::vertex_index_t>, 1> _Ty=D, 1> T=D, 1> ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::adj_list_vertex_property_map<slGraph,unsigned int,const unsigned int &,boost::vertex_index_t>,boost::default_color_type,boost::default_color_type &>, 1> PredecessorMap=void **__w64 , 1> Compare=std::less<D>, 1> Combine=boost::closed_plus<D>, 1> DistInf=int, 1> DistZero=int, 1> DijkstraVisitor=boost::dijkstra_visitor<> 1> ] 1> c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(322) : see reference to function template instantiation 'void boost::detail::dijkstra_dispatch2<VertexListGraph,int*__w64 ,WeightMap,IndexMap,Params,boost::iterator_property_map<RandomAccessIterator,IndexMap,T,R>>(const VertexListGraph &,void *,DistanceMap,WeightMap,IndexMap,const Params &,ColorMap)' being compiled 1> with 1> [ 1> VertexListGraph=slGraph, 1> WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,long double,const long double &,void *,const boost::property<boost::edge_weight_t,slScoreValueType>,boost::edge_weight_t>, 1> IndexMap=boost::adj_list_vertex_property_map<slGraph,unsigned int,const unsigned int &,boost::vertex_index_t>, 1> Params=boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<void **__w64 ,boost::vertex_predecessor_t,boost::no_property>>, 1> RandomAccessIterator=std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>, 1> T=boost::default_color_type, 1> R=boost::default_color_type &, 1> DistanceMap=int *__w64 , 1> ColorMap=boost::iterator_property_map<std::_Vector_iterator<boost::default_color_type,std::allocator<boost::default_color_type>>,boost::adj_list_vertex_property_map<slGraph,unsigned int,const unsigned int &,boost::vertex_index_t>,boost::default_color_type,boost::default_color_type &> 1> ] 1> c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(342) : see reference to function template instantiation 'void boost::detail::dijkstra_dispatch1<VertexListGraph,int*__w64 ,boost::adj_list_edge_property_map<Directed,Value,Ref,Vertex,Property,Tag>,boost::adj_list_vertex_property_map<Graph,ValueType,Reference,boost::vertex_index_t>,boost::bgl_named_params<T,boost::vertex_distance_t,Base>,boost::detail::error_property_not_found>(const VertexListGraph &,void *,DistanceMap,WeightMap,IndexMap,const Params &,ColorMap)' being compiled 1> with 1> [ 1> VertexListGraph=slGraph, 1> Directed=boost::bidirectional_tag, 1> Value=long double, 1> Ref=const long double &, 1> Vertex=void *, 1> Property=const boost::property<boost::edge_weight_t,slScoreValueType>, 1> Tag=boost::edge_weight_t, 1> Graph=slGraph, 1> ValueType=unsigned int, 1> Reference=const unsigned int &, 1> T=int *__w64 , 1> Base=boost::bgl_named_params<void **__w64 ,boost::vertex_predecessor_t,boost::no_property>, 1> DistanceMap=int *__w64 , 1> WeightMap=boost::adj_list_edge_property_map<boost::bidirectional_tag,long double,const long double &,void *,const boost::property<boost::edge_weight_t,slScoreValueType>,boost::edge_weight_t>, 1> IndexMap=boost::adj_list_vertex_property_map<slGraph,unsigned int,const unsigned int &,boost::vertex_index_t>, 1> Params=boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<void **__w64 ,boost::vertex_predecessor_t,boost::no_property>>, 1> ColorMap=boost::detail::error_property_not_found 1> ] 1> c:\probt_slp\work\yasin\test\pc\algopc.cpp(251) : see reference to function template instantiation 'void boost::dijkstra_shortest_paths<slGraph,int*__w64 ,boost::vertex_distance_t,boost::bgl_named_params<T,Tag,Base>>(const VertexListGraph &,void *,const boost::bgl_named_params<int *__w64 ,boost::vertex_distance_t,boost::bgl_named_params<T,Tag,Base>> &)' being compiled 1> with 1> [ 1> T=void **__w64 , 1> Tag=boost::vertex_predecessor_t, 1> Base=boost::no_property, 1> VertexListGraph=slGraph 1> ] 1>c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(252) : error C2664: 'void put<void*,void*>(T *,ptrdiff_t,const V &)' : cannot convert parameter 2 from 'void *' to 'ptrdiff_t' 1> with 1> [ 1> T=void *, 1> V=void * 1> ] 1> There is no context in which this conversion is possible 1>c:\probt_slp\boost\include\boost\graph\dijkstra_shortest_paths.hpp(255) : error C2664: 'void put<int,DistInf>(T *,ptrdiff_t,const V &)' : cannot convert parameter 2 from 'void *' to 'ptrdiff_t' 1> with 1> [ 1> DistInf=int, 1> T=int, 1> V=int 1> ] 1> There is no context in which this conversion is possible 1>Build log was saved at "file://c:\ProBT_SLP\work\yasin\test\Debug\BuildLog.htm" 1>testPC - 3 error(s), 75 warning(s) ============================================================================================================== I will be thankful to you for your guidance. Regards Amanullah YASIN Master2 (ECD) Ecole Polytechnique Université de Nantes, France. Mob# 06 47 62 89 96 Fix # 02 72 00 26 45 amanyasin@gmail.com
Thanks for your reply, typedef boost::property<boost::vertex_index_t, unsigned int, boost::property<boost::computable_object_t, plComputableObject*> > slVertexProperty; typedef boost::property<boost::edge_weight_t, slScoreValueType> slEdgeProperty; typedef boost::adjacency_list<boost::vecS, boost::listS, boost::bidirectionalS, slVertexProperty, slEdgeProperty> slGraph; slGraph graph; Thanks Amanullah YASIN Master2 (ECD) Ecole Polytechnique Université de Nantes, France. Mob# 06 47 62 89 96 Fix # 02 72 00 26 45 amanyasin@gmail.com On Thu, Jun 11, 2009 at 3:41 PM, Andrew Sutton <andrew.n.sutton@gmail.com>wrote:
so, now i want to implement dijkstra_shortest_path , it is giving errors.
Please guide me how i can implement this method.
It's hard to say without a little more context. What is the type of the graph?
Andrew Sutton andrew.n.sutton@gmail.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
typedef boost::adjacency_list<boost::vecS, boost::listS, boost::bidirectionalS, slVertexProperty, slEdgeProperty> slGraph;
The errors look like they're coming from an attempt to reinterpret a node-based vertex descriptor (void*) as a vector-based descriptor (int). It doesn't look like you're passing the index_map to the first Dijkstra's call. That might be causing the problem. Andrew Sutton andrew.n.sutton@gmail.com
Dear Andrew would you like to guide me in more detail? or any easy way to implement this method. Thanks Amanullah YASIN Master2 (ECD) Ecole Polytechnique Université de Nantes, France. Mob# 06 47 62 89 96 Fix # 02 72 00 26 45 amanyasin@gmail.com On Fri, Jun 12, 2009 at 2:03 AM, Andrew Sutton <andrew.n.sutton@gmail.com>wrote:
typedef boost::adjacency_list<boost::vecS, boost::listS,
boost::bidirectionalS, slVertexProperty, slEdgeProperty> slGraph;
The errors look like they're coming from an attempt to reinterpret a node-based vertex descriptor (void*) as a vector-based descriptor (int). It doesn't look like you're passing the index_map to the first Dijkstra's call. That might be causing the problem.
Andrew Sutton andrew.n.sutton@gmail.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Amanullah Yasin
-
Andrew Sutton