<div>Dirk,</div><div><br></div>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.<div><br></div>
<div>2. Create a vtkSelection representing a threshold 0-2 on the "BFS" array. Something along the lines of:</div><div><br></div><div>vtkIntArray* arr = vtkIntArray::New();</div><div>arr->InsertNextValue(0);</div>
<div>arr->InsertNextValue(2);</div><div>arr->SetName("BFS");</div><div><div>vtkSelectionNode* node = vtkSelectionNode::New();</div><div>node->SetContentType(vtkSelectionNode::THRESHOLDS);</div><div>node->SetFieldType(vtkSelectionNode::VERTICES);</div>
<div>node->SetSelectionList(arr);</div><div>vtkSelection* sel = vtkSelection::New();</div><div>sel->AddNode(node);</div><div><br></div><div>See the source article here</div><div><br></div><div><a href="http://kitware.com/products/thesource/apr2009.html">http://kitware.com/products/thesource/apr2009.html</a></div>
<div><br></div><div>for more details on vtkSelection.</div><div><br></div></div><div>3. Use vtkExtractSelectedGraph, first input the output of the BFS filter, second input the selection.</div><div><br></div><div>HTH,</div>
<div>Jeff<br><br><div class="gmail_quote">On Wed, Aug 5, 2009 at 3:20 PM, Dirk VanBruggen <span dir="ltr"><<a href="mailto:dirk.c.vanbruggen@gmail.com">dirk.c.vanbruggen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear All,<br><br>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?<br>
<br>Thank you in advance for all of your help.<br><br>Regards,<br><font color="#888888">Dirk<br>
</font><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>
</div>