<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi everyone,<br>
    <br>
    I recently moved on from VTK 5.8 / 5.10 to the 6.3 build and
    apparently the vtkGraph behaves now a bit unexpected.<br>
    <br>
    In the minimal example below I load an undirected graph (points
    & pedigreeIDs attached to vertices, spatially neighbouring
    vertices are connected), collect all pedIDs and then try to remove
    one vertex after the other, using their pedIDs. That worked
    perfectly fine in 5.8.<br>
    <br>
    And it works fine for the first couple hundred vertices, but
    occasionally some throw the following message:<br>
    <span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">ERROR: In /path/to/</span><a href="http://vtk-6.3.0/Common/DataModel/vtkGraphInternals.cxx" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; wh
ite-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">VTK-6.3.0/Common/DataModel/vtkGraphInternals.cxx</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">, line 53
vtkGraphInternals (0x7ffc54080080): Could not find edge in source edge list.</span><br>
    <br>
    In another test I tried to manually remove all edges of a vertex
    before removing the vertex itself, which didn't help either in the
    above cases: The number of edges of the graph was correctly
    decremented by the number of egdes the vertex had. But despite the
    vertices that threw above error message apparently had still some of
    the edges they previously had.<br>
    <br>
    Is there a new update-call that is mandatory after removal of
    vertices/edges, or is it a bug? Any idea where it is coming from? I
    tried 6.2 with the same result.<br>
    <br>
    <br>
    I am a bit lost here, help is much appreciated,<br>
    <br>
    Adrian.<br>
    <br>
    <br>
    <br>
    <span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">            vtkSmartPointer<vtkMutableUndirectedGraph> g = vtkMutableUndirectedGraph::New();

            vtkSmartPointer<vtkGraphReader> graphReader = vtkSmartPointer<vtkGraphReader>::New();
            graphReader->SetFileName("/path/to/</span><a href="http://graph.txt/" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">graph.txt</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; 
white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">");
            graphReader->Update();
            graphReader->GetOutput()->ToUndirectedGraph(g);

            std::cout << "graph has " << g->GetVertexData()->GetNumberOfArrays() << " vertex arrays and " << g->GetEdgeData()->GetNumberOfArrays() << " edge arrays" << std::endl;


            vtkSmartPointer<vtkUnsignedLongArray> pedigreeIdArray = vtkUnsignedLongArray::SafeDownCast(g->GetVertexData()->GetPedigreeIds());
            vtkSmartPointer<vtkVertexListIterator> it = vtkSmartPointer<vtkVertexListIterator>::New();
            g->GetVertices(it);

            std::set<vtkIdType> vertsToDelete;

            while (it->HasNext()) {
                vtkIdType v = it->Next();
                </span><a href="http://vertstodelete.insert%28pedigreeidarray-/" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">vertsToDelete.insert(pedigreeIdArray-</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px
; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">>GetValue(v));
            }

            for(std::set<vtkIdType>::iterator it=</span><a href="http://vertstodelete.begin%28%29%3B/" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">vertsToDelete.begin();</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; tex
t-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);"> it!=</span><a href="http://vertstodelete.end%28%29%3B/" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">vertsToDelete.end();</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: nor
mal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);"> ++it) {
                g->RemoveVertex(g->FindVertex(*it));
                g->Modified();

                std::cout << "num verts = " << g->GetNumberOfVertices() << " and num pedIDEntries = " << g->GetVertexData()->GetPedigreeIds()->GetNumberOfTuples() << std::endl;

                for(int i=0; i<g->GetVertexData()->GetNumberOfArrays(); i++)
                    g->GetVertexData()->GetArray(i)->DataChanged();

                g->Squeeze();
            }

            vtkSmartPointer<vtkGraphWriter> graphWriter = vtkSmartPointer<vtkGraphWriter>::New();
            graphWriter->SetFileName("/scratch/friebel/TestData/graphVTKError/</span><a href="http://graph_collapsed.txt/" target="_blank" style="margin: 6px 0px; padding: 0px; box-sizing: inherit; outline: none; cursor: pointer; color: rgb(35, 42, 42); text-decoration: underline; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">graph_collapsed.txt</a><span style="margin: 0px; padding: 0px; box-sizing: inherit; outline: none; color: rgb(35, 42, 42); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-ali
gn: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(236, 240, 240);">");
            graphWriter->SetInputData(g);
            graphWriter->Update();</span><br>
  </body>
</html>