|
Boost Users : |
Subject: Re: [Boost-users] [BGL] setS as an edge container
From: Cedric Laczny (cedric.laczny_at_[hidden])
Date: 2010-12-29 03:25:18
On Tuesday, 28. December 2010 20:02:01 Datalurkur wrote:
> I'm attempting to set up pathfinding using Dijkstra's algorithm, and
> decided to use setS since I need to add/remove edges frequently and don't
> want to worry about adding parallel edges. My typedefs are such:
>
> typedef property<edge_weight_t, int> Weight;
> typedef adjacency_list<vecS, setS, undirectedS, no_property, Weight> Graph;
> typedef graph_traits<Graph>::vertex_descriptor VertexDescriptor;
> typedef graph_traits<Graph>::edge_descriptor EdgeDescriptor;
>
> However, when trying to actually call dijkstra_shortest_paths, like so:
>
> std::vector<VertexDescriptor> predecessorMap(num_vertices(*_graph));
> std::vector<int> distanceMap(num_vertices(*_graph));
> dijkstra_shortest_paths(*_graph, startVertex,
> predecessor_map(&predecessorMap[0]).distance_map(&distanceMap[0]));
>
> I wind up with a bunch of compile errors within boost. Some examples:
> .../Boost.framework/Headers/graph/dijkstra_shortest_paths.hpp:377: error:
> no matching function for call to 'put(int*&, void* const&, int&)'
> .../Boost.framework/Headers/graph/two_bit_color_map.hpp:77: error: invalid
> cast from type 'boost::detail::error_property_not_found' to type 'size_t'
> .../Boost.framework/Headers/graph/dijkstra_shortest_paths.hpp:139: error:
> no matching function for call to 'get(int*&, void*)'
>
> I suspect it has something to do with the index map, but I assumed that
> vertex mappings that used vecS didn't need to be supplied with an index
> map.
You got that right, actually, but in your code, you are not using the vecS for
the vertices but for the edges. Seems to me that you simply mixed up the
positions.
Pleas see: adjacency_list<OutEdgeList, VertexList, Directed,
VertexProperties, EdgeProperties,
GraphProperties, EdgeList>
from http://www.boost.org/doc/libs/1_36_0/libs/graph/doc/adjacency_list.html
> I followed the dijkstra example as closely as possible, but since
> they have a static set of edges and use vecS to store the edge map, I'm
> pretty certain that's where the discrepancy lies. Any other examples,
> advice?
>
Best,
Cedric
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