[vtkusers] Potential bug in graph pedigreeId handling / AbstractArray::LookupValue

Adrian Friebel friebel at izbi.uni-leipzig.de
Wed Aug 27 09:28:58 EDT 2014


Hey,
so far I compiled my software against vtk 5.8. Recently I tried to 
compile it against 5.10.1 and noticed unexpected behaviour while adding 
vertices to a graph while passing pedigree ids.
Below a minimal example and its output:

#include <stdio.h>
#include <iostream>

#include <vtkDataSetAttributes.h>
#include <vtkMutableUndirectedGraph.h>
#include <vtkSmartPointer.h>
#include <vtkUnsignedLongArray.h>

int  main(int argc, char **argv)
{
     vtkSmartPointer<vtkMutableUndirectedGraph> graph = 
vtkSmartPointer<vtkMutableUndirectedGraph>::New();

     vtkSmartPointer<vtkUnsignedLongArray> pedigreeIds = 
vtkSmartPointer<vtkUnsignedLongArray>::New();
     pedigreeIds->Initialize();
     pedigreeIds->SetName("Pedigree IDs");

     graph->GetVertexData()->SetPedigreeIds(pedigreeIds);

     for(unsigned int i=0; i<10; ++i) {
         vtkIdType v = graph->AddVertex(i*100);
         std::cout << "i = " << i << ": v = " << v <<
                 ", graph->GetVertex[..]->GetVariantValue( " << v << ") 
= " << graph->GetVertexData()->GetPedigreeIds()->GetVariantValue(v) <<
                 ", graph->FindVertex(" << i << "*100) = " << 
graph->FindVertex(i*100) << std::endl;
     }
     return 0;
}

VTK-5.8:
i = 0: v = 0, graph->GetVertex[..]->GetVariantValue( 0) = 0, 
graph->FindVertex(0*100) = 0
i = 1: v = 1, graph->GetVertex[..]->GetVariantValue( 1) = 100, 
graph->FindVertex(1*100) = 1
i = 2: v = 2, graph->GetVertex[..]->GetVariantValue( 2) = 200, 
graph->FindVertex(2*100) = 2
i = 3: v = 3, graph->GetVertex[..]->GetVariantValue( 3) = 300, 
graph->FindVertex(3*100) = 3
i = 4: v = 4, graph->GetVertex[..]->GetVariantValue( 4) = 400, 
graph->FindVertex(4*100) = 4
i = 5: v = 5, graph->GetVertex[..]->GetVariantValue( 5) = 500, 
graph->FindVertex(5*100) = 5
i = 6: v = 6, graph->GetVertex[..]->GetVariantValue( 6) = 600, 
graph->FindVertex(6*100) = 6
i = 7: v = 7, graph->GetVertex[..]->GetVariantValue( 7) = 700, 
graph->FindVertex(7*100) = 7
i = 8: v = 8, graph->GetVertex[..]->GetVariantValue( 8) = 800, 
graph->FindVertex(8*100) = 8
i = 9: v = 9, graph->GetVertex[..]->GetVariantValue( 9) = 900, 
graph->FindVertex(9*100) = 9

VTK-5.10.1:
i = 0: v = 0, graph->GetVertex[..]->GetVariantValue( 0) = 0, 
graph->FindVertex(0*100) = 0
i = 1: v = 1, graph->GetVertex[..]->GetVariantValue( 1) = 100, 
graph->FindVertex(1*100) = 1
i = 2: v = 2, graph->GetVertex[..]->GetVariantValue( 2) = 200, 
graph->FindVertex(2*100) = -1
i = 3: v = 3, graph->GetVertex[..]->GetVariantValue( 3) = 300, 
graph->FindVertex(3*100) = 3
i = 4: v = 4, graph->GetVertex[..]->GetVariantValue( 4) = 400, 
graph->FindVertex(4*100) = -1
i = 5: v = 5, graph->GetVertex[..]->GetVariantValue( 5) = 500, 
graph->FindVertex(5*100) = -1
i = 6: v = 6, graph->GetVertex[..]->GetVariantValue( 6) = 600, 
graph->FindVertex(6*100) = -1
i = 7: v = 7, graph->GetVertex[..]->GetVariantValue( 7) = 700, 
graph->FindVertex(7*100) = 7
i = 8: v = 8, graph->GetVertex[..]->GetVariantValue( 8) = 800, 
graph->FindVertex(8*100) = -1
i = 9: v = 9, graph->GetVertex[..]->GetVariantValue( 9) = 900, 
graph->FindVertex(9*100) = -1


It seems that there is something wrong with the 
AbstractArray::LookupValue in 5.10.1, since the array entries 
value->pedId are made.
I am aware that 6.1 was released some time ago. Maybe the issue was 
solved already, but since I couldn't find any reports on this I thought 
I might inform you guys.
Or am I just missing some newly introduced update call?

Best,
Adrian.

-- 
Dipl.-Inform. Adrian Friebel
Research Group for Multicellular Systems Biology
Interdisciplinary Centre for BioInformatics
University of Leipzig
Haertelstrasse 16-18
04107 Leipzig
Germany
Tel.: +49 341 97-16627
email:	adrian.friebel at uni-leipzig.de



More information about the vtkusers mailing list