Serious performance issue in vtkGraphs when removing vertices
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
vtkGraph seems to have a serious bottleneck when removing vertices from the graph structure.
vtkGraph::RemoveVerticesInternal() internally calls vtkGraph::RemoveVertexInternal() which recomputes the edge list structure in every call:
vtkGraph.cxx:1458ff
this->ForceOwnership(); this->BuildEdgeList(); // This function assumes the edge list is created.
I am not totally sure abut the additional comment concerning the assumption. I could not find any reason for an unconditional update of the edge list so far. Therefore, I'd suggest to add the following condition:
this->ForceOwnership(); if (!this->EdgeList) { this->BuildEdgeList(); }
Other functions seem to call BuildEdgeList() with exactly the same condition.