dijkstra_shortest_paths with a graph with bundled edge properties
This example works fine: http://programmingexamples.net/index.php?title=CPP/Boost/BGL/DijkstraUndirec... However, if I change typedef boost::property<boost::edge_weight_t, float> EdgeWeightProperty; to struct EdgeWeightProperty{float weight;}; (and of course remove the lines adding the weights as properties: boost::add_edge(v1, v2, weight1, g); ) I get crazy template errors: /usr/include/boost/graph/dijkstra_shortest_paths.hpp: In member function ‘void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor, UpdatableQueue, WeightMap, PredecessorMap, DistanceMap, BinaryFunction, BinaryPredicate>::examine_edge(Edge, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, Graph = const boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, UniformCostVisitor = boost::dijkstra_visitor<>, UpdatableQueue = boost::d_ary_heap_indirect<unsigned int, 4u, boost::iterator_property_map<unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, unsigned int, unsigned int&>, int*, std::less<int>, std::vector<unsigned int> >, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, PredecessorMap = unsigned int*, DistanceMap = int*, BinaryFunction = boost::closed_plus<int>, BinaryPredicate = std::less<int>]’: /usr/include/boost/graph/breadth_first_search.hpp:77:47: instantiated from ‘void boost::breadth_first_visit(const IncidenceGraph&, typename boost::graph_traits<IncidenceGraph>::vertex_descriptor, Buffer&, BFSVisitor, ColorMap) [with IncidenceGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, Buffer = boost::d_ary_heap_indirect<unsigned int, 4u, boost::iterator_property_map<unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, unsigned int, unsigned int&>, int*, std::less<int>, std::vector<unsigned int> >, BFSVisitor = boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<unsigned int, 4u, boost::iterator_property_map<unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, unsigned int, unsigned int&>, int*, std::less<int>, std::vector<unsigned int> >, boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, unsigned int*, int*, boost::closed_plus<int>, std::less<int> >, ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int> >, typename boost::graph_traits<IncidenceGraph>::vertex_descriptor = unsigned int]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:332:5: instantiated from ‘void boost::dijkstra_shortest_paths_no_init(const Graph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistZero, DijkstraVisitor, ColorMap) [with Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, DijkstraVisitor = boost::dijkstra_visitor<>, PredecessorMap = unsigned int*, DistanceMap = int*, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, Compare = std::less<int>, Combine = boost::closed_plus<int>, DistZero = int, ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int> >, typename boost::graph_traits<Graph>::vertex_descriptor = unsigned int]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:383:5: instantiated from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<VertexListGraph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, ColorMap) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, DijkstraVisitor = boost::dijkstra_visitor<>, PredecessorMap = unsigned int*, DistanceMap = int*, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, Compare = std::less<int>, Combine = boost::closed_plus<int>, DistInf = int, DistZero = int, ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int> >, typename boost::graph_traits<VertexListGraph>::vertex_descriptor = unsigned int]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:353:5: instantiated from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<VertexListGraph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<VertexListGraph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, DijkstraVisitor = boost::dijkstra_visitor<>, PredecessorMap = unsigned int*, DistanceMap = int*, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, Compare = std::less<int>, Combine = boost::closed_plus<int>, DistInf = int, DistZero = int, T = int*, Tag = boost::vertex_distance_t, Base = boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t, boost::no_property>, typename boost::graph_traits<VertexListGraph>::vertex_descriptor = unsigned int, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<VertexListGraph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:423:7: instantiated from ‘void boost::detail::dijkstra_dispatch2(const VertexListGraph&, typename boost::graph_traits<VertexListGraph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, DistanceMap = int*, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, Params = boost::bgl_named_params<int*, boost::vertex_distance_t, boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t, boost::no_property> >, typename boost::graph_traits<VertexListGraph>::vertex_descriptor = unsigned int]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:455:7: instantiated from ‘void boost::detail::dijkstra_dispatch1(const VertexListGraph&, typename boost::graph_traits<VertexListGraph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, DistanceMap = int*, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, unsigned int, const boost::property<boost::edge_bundle_t, EdgeWeightProperty, boost::no_property>, boost::edge_weight_t>, IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, unsigned int>, Params = boost::bgl_named_params<int*, boost::vertex_distance_t, boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t, boost::no_property> >, typename boost::graph_traits<VertexListGraph>::vertex_descriptor = unsigned int]’ /usr/include/boost/graph/dijkstra_shortest_paths.hpp:473:5: instantiated from ‘void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<IncidenceGraph>::vertex_descriptor, const boost::bgl_named_params<P, T, R>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty>, Param = int*, Tag = boost::vertex_distance_t, Rest = boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t, boost::no_property>, typename boost::graph_traits<IncidenceGraph>::vertex_descriptor = unsigned int]’ Any chance anyone can interpret these? Thanks, David
On Wed, 26 Oct 2011, David Doria wrote:
This example works fine:
http://programmingexamples.net/index.php?title=CPP/Boost/BGL/DijkstraUndirec...
However, if I change
typedef boost::property<boost::edge_weight_t, float> EdgeWeightProperty;
to
struct EdgeWeightProperty{float weight;};
(and of course remove the lines adding the weights as properties: boost::add_edge(v1, v2, weight1, g); )
Did you change the weight map argument to dijkstra_shortest_paths to &EdgeWeightProperty::weight? It appears that you might not have; the error message is claiming that the weight map is error_property_not_found, which is what is produced when an old-style property map looked up in a graph doesn't exist. -- Jeremiah Willcock
Did you change the weight map argument to dijkstra_shortest_paths to
&EdgeWeightProperty::weight? It appears that you might not have; the error message is claiming that the weight map is error_property_not_found, which is what is produced when an old-style property map looked up in a graph doesn't exist.
-- Jeremiah Willcock
Ah, I see. Thanks. David
participants (2)
-
David Doria
-
Jeremiah Willcock