
Andrew Sutton wrote:
On Tue, Oct 6, 2009 at 10:38 AM, Ralf Goertz
wrote: I managed to create a visitor now, however, instead of speeding things up dijkstra_shortest_paths now runs several orders of magnitudes slower! I created the visitor according to the bfs_name_printer example in the BGL User Guide and Reference Book page 11. The code seems to do what I want, all dists are either 0,1,2,3 or
numeric_limits<unsigned>::max(). But for a graph with 15000 edges it takes a few ms to run dijkstra without a visitor but with it it takes 14 seconds. What am I doing wrong?
Are you compiling in debug mode? It can cause dramatic slowdowns with the BGL.
No, I use full optimization with g++ version 4.3: "CXXFLAGS=-O3 -Wno-deprecated" is in my Makefile. I also noticed that when I explicitely use .visitor(default_dijkstra_visitor) or my derived class without the "void finish_vertex(Vertex u, Graph g)" no harm is done. In the header files I found the macro BOOST_GRAPH_EVENT_STUB being applied to the default_bfs_visitor. Do I need to apply it to my derived class as well?