[vtkusers] Bug in vtkBoostPrimMinimumSpanningTree?

Jeff Baumes jeff.baumes at kitware.com
Fri May 21 13:18:08 EDT 2010


On Fri, May 21, 2010 at 12:48 PM, Thompson, David C <dcthomp at sandia.gov> wrote:
>> I indeed introduced a bug when I made the following change:
>> ...
>> The correct fix is to add the loop back in, but just perform the
>> AddVertex(), not the CopyData(). This does the same thing as David T's
>> fix, but in a less hackish way. I've published the fix, let me know if
>> there are further issues.
>
> Nope, that fixes it for me. Thanks.
>
> I do have a question (not a criticism): you say what I did was more
> hackish but couldn't it also be faster and end up using less memory?
> By calling AddVertex once for each of N vertices, the STL container is forced
> to reallocate log(N) times and will end up allocating 2**(floor(log2(N))+1)
> entries instead of exactly N entries. If that could be a significant problem,
> would it be a good idea to add a call like "SetNumberOfVertices" to the
> mutable graph classes?

I like the SetNumberOfVertices() idea, it would indeed be faster and
use less memory. What I meant was that vtkGraphInternals and
vtkVertexAdjacencyList are not meant to be manipulated directly, but
should be changed by using other vtkGraph API.

Jeff



More information about the vtkusers mailing list