[vtk-developers] New class: vtkGraphLargestConnectedComponent

David Doria daviddoria+vtk at gmail.com
Fri May 21 14:02:52 EDT 2010


> I'll add one: You shouldn't directly connect an input's producer port
> to an internal algorithm like you are doing with
> vtkBoostConnectedComponents. Instead you should make a new instance of
> the graph and perform a ShallowCopy(), then send that into the
> internal algorithm. Similarly, you should ShallowCopy() the output of
> the last filter into the real filter output object.
>
> Also, we have been putting the Boost prefix on anything that depends
> on Boost. The name you have is already remarkably long, but perhaps
> something like vtkBoostExtractLargestComponent would work?
>
> Jeff

Thanks Jeff,

I renamed it and fixed the input -> filter flow.

http://www.rpi.edu/~doriad/VTK_List/vtkBoostExtractLargestComponent/

You said

"Similarly, you should ShallowCopy() the output of
the last filter into the real filter output object."

Is that not what this is doing:?
output->ShallowCopy(extractSelectedGraph->GetOutput());

Do I have to, instead, do :

vtkSmartPointer<vtkMutableUndirectedGraph> tempOutput =
  vtkSmartPointer<vtkMutableUndirectedGraph>::New();
tempOutput->ShallowCopy(extractSelectedGraph->GetOutput());
output->ShallowCopy(tempOutput);

Thanks,

David



More information about the vtk-developers mailing list