Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] premature termination in dijkstra using visitor
From: Ralf Goertz (R_Goertz_at_[hidden])
Date: 2009-10-07 08:48:20


Andrew Sutton wrote:

>> > 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?
>>
>
> I see the problem... You're passing your graph by value to the visitor
> function, meaning you're making a copy of the graph every time you
> visit a vertex. That should certainly account for the increased time :)

Argh, I was so sure that I typed everything correctly. Thanks for
finding the problem.


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