[vtkusers] vtk Graph - Extracting a Subgraph
Jeff Baumes
jeff.baumes at kitware.com
Wed Aug 5 16:43:08 EDT 2009
Dirk,
1. vtkBoostBreadthFirstSearch will create an integer array "BFS" on the
vertices, the distance from the starting point. You can set the starting
vertex on the filter.
2. Create a vtkSelection representing a threshold 0-2 on the "BFS" array.
Something along the lines of:
vtkIntArray* arr = vtkIntArray::New();
arr->InsertNextValue(0);
arr->InsertNextValue(2);
arr->SetName("BFS");
vtkSelectionNode* node = vtkSelectionNode::New();
node->SetContentType(vtkSelectionNode::THRESHOLDS);
node->SetFieldType(vtkSelectionNode::VERTICES);
node->SetSelectionList(arr);
vtkSelection* sel = vtkSelection::New();
sel->AddNode(node);
See the source article here
http://kitware.com/products/thesource/apr2009.html
for more details on vtkSelection.
3. Use vtkExtractSelectedGraph, first input the output of the BFS filter,
second input the selection.
HTH,
Jeff
On Wed, Aug 5, 2009 at 3:20 PM, Dirk VanBruggen <dirk.c.vanbruggen at gmail.com
> wrote:
> Dear All,
>
> I am trying to find a way to take a graph, and extract a subgraph that
> contains a given vertex and all vertices within two hops of the given
> vertex. Is there a boost algorithm or a different way to accomplish this?
>
> Thank you in advance for all of your help.
>
> Regards,
> Dirk
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090805/7dcc5c0f/attachment.htm>
More information about the vtkusers
mailing list