Problem with writing a dijkstra_visitor

Hi, I'm trying to write a dijkstra visitor, that sets the weight of an egde to the maximum value after assigning it to a minimum spanning tree. The visitor is created according to the bacon sample: template <typename WeightMap> class special_dijkstra_visitor : public boost::default_dijkstra_visitor { public: special_dijkstra_visitor(WeightMap& w):default_dijkstra_visitor(),weight_map_(w){}; template <typename Edge, typename Graph> void edge_relaxed(Edge e, Graph& g) { weight_map_[e] = DBL_MAX; } template <class Edge, class Graph> void edge_not_relaxed(Edge e, Graph& g) { weight_map_[e] = DBL_MAX; } private: WeightMap weight_map_; }; // Convenience function template <typename WeightMap> special_dijkstra_visitor<WeightMap> visit_special_dijkstra(WeightMap w) { return special_dijkstra_visitor<WeightMap>(w); } The graph based on an adjacency matrix with property<edge_weight_t, double> The visitor is called by: property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); prim_minimum_spanning_tree(g, root, &p[0], distance, weightmap, indexmap, visitor(visit_special_dijkstra(weightmap))); The linux gnu 3.4.4 compiler gives the following error messages *snip template instance error messages* /zeug/study/OpenMSLibs/CGAL-3.1-gcc-3.4.4/include/boost/graph/dijkstra_shortest_paths.hpp:120: error: ` edge_relaxed' undeclared (first use this function) /zeug/study/OpenMSLibs/CGAL-3.1-gcc-3.4.4/include/boost/graph/dijkstra_shortest_paths.hpp:122: error: ` edge_not_relaxed' undeclared (first use this function) /zeug/study/OpenMSLibs/CGAL-3.1-gcc-3.4.4/include/boost/graph/dijkstra_shortest_paths.hpp:143: error: ` finish_vertex' undeclared (first use this function) ... I'm wondering, cause I thought deriving from default_dijkstra_visitor ensures that finish_vertex is allready implemented. Compiling the bacon sample on the same graph works fine. So I'm really confused. Any hints for debugging the code? Thanks a lot. Regards Fabian

On Aug 6, 2005, at 3:31 PM, Fabian Buske wrote:
The visitor is called by: property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g); prim_minimum_spanning_tree(g, root, &p[0], distance, weightmap, indexmap, visitor(visit_special_dijkstra(weightmap)));
I believe this is the problem. Remove the "visitor" call, so that the call to Prim's algorithm is:
prim_minimum_spanning_tree(g, root, &p[0], distance, weightmap, indexmap, visit_special_dijkstra(weightmap));
Doug
participants (2)
-
Doug Gregor
-
Fabian Buske