<div dir="ltr">You can use vtkTreeBFSIterator to iterate over a vtkTree in a loop (so you need a vtkTree to use this). vtkBoostBreadthFirstSearchTree is a vtkAlgorithm that takes a vtkGraph as input, along with a root vertex, and generates a vtkTree as its output, which is the BFS tree starting at the root vertex..<div>
<br></div><div style>HTH,</div><div style>Jeff</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 7:37 AM, Dr. Roman Grothausmann <span dir="ltr">&lt;<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Jeff,<br>
<br>
<br>
Many thanks for Your reply. I had come across vtkTreeBFSIterator but since that only takes an already existent tree as input, I deemed this not to be the right method for my task.<br>
Now I wonder what the difference is between vtkTreeBFSIterator and vtkBoostBreadthFirstSearchTree<u></u>?<br>
Perhaps it would be sensible to mention each other method in their docs. I had searched for BFS, therefore it did not hit BreadthFirstSearch:-(<br>
<br>
Thanks again for Your help<br>
Roman<div class="im"><br>
<br>
On 24/01/13 15:55, Jeff Baumes wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
If you have a vtkGraph, you can convert it to a vtkTree with<br>
vtkBoostBreadthFirstSearchTree<u></u>. Then you can probably use the tree iterators do<br>
make the path you desire.<br>
<br>
Jeff<br>
<br>
<br>
On Fri, Jan 18, 2013 at 2:49 PM, Dr. Roman Grothausmann<br></div>
&lt;<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a> &lt;mailto:<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-<u></u>hannover.de</a>&gt;&gt;<div class="im">
<br>
wrote:<br>
<br>
    Dear mailing list members,<br>
<br>
<br>
    Now that I have managed to convert vtkPolyData (which represents a tree, the<br>
    root node position is known) to a vtkGraph (thanks to David Doria&#39;s<br></div>
    vtkPolyDataToGraph: <a href="https://github.com/daviddoria/__VTK-GraphConversions" target="_blank">https://github.com/daviddoria/<u></u>__VTK-GraphConversions</a><br>
    &lt;<a href="https://github.com/daviddoria/VTK-GraphConversions" target="_blank">https://github.com/<u></u>daviddoria/VTK-<u></u>GraphConversions</a>&gt;)<div><div class="h5"><br>
    I&#39;m now facing the problem how to convert the tree that is contained in the<br>
    vtkGraph into a vtkTree?<br>
    In the docs it is said that a tree can only be created via<br>
    vtkMutableDirectedGraph, so guess I need to traverse the vtkGraph in a way<br>
    that the traversal yields a tree and during traversal a<br>
    vtkMutableDirectedGraph needs to be created.<br>
    But how to traverse the graph? In the docs it says that vtkTreeDFSIterator<br>
    would iterate through a graph but it inherits vtkTreeIterator and only has a<br>
    method setTree (no setGraph).<br>
    Is there any other way to tell a PC that a graph is actually a tree if it is<br>
    told where the root node is?<br>
<br>
    My final goal is to create a vtkPolyData that represents the path walked by<br>
    e.g. a person that starts walking along the tree from the root, visiting<br>
    every node along a branch till it reaches its end, then goes back to the<br>
    next branching node (i.e. parent node with more than one child) and then<br>
    goes an like that until it comes back to the root. The person should then<br>
    have visited each node at least twice except end-nodes. If the start and the<br>
    end point of the path are connected the result would be a directed loop.<br>
    The result could be created very easily by duplicating the initial<br>
    vtkPolyData and joining the two at each end-node, only the joints needed at<br>
    the branching-nodes give trouble.<br>
<br>
    Any help or hints is very much appreciated<br>
    Roman<br>
<br>
<br>
    --<br>
    Dr. Roman Grothausmann<br>
<br>
    Tomographie und Digitale Bildverarbeitung<br>
    Tomography and Digital Image Analysis<br>
<br>
    Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
    Medizinische Hochschule Hannover<br>
    Carl-Neuberg-Str. 1<br>
    D-30625 Hannover<br>
<br></div></div>
    Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a> &lt;tel:%2B49%20511%20532-9574&gt;<br>
    ______________________________<u></u>___________________<br>
    Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="im"><br>
<br>
    Visit other Kitware open-source projects at<br></div>
    <a href="http://www.kitware.com/__opensource/opensource.html" target="_blank">http://www.kitware.com/__<u></u>opensource/opensource.html</a><div class="im"><br>
    &lt;<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a>&gt;<br>
<br>
    Please keep messages on-topic and check the VTK FAQ at:<br></div>
    <a href="http://www.vtk.org/Wiki/VTK___FAQ" target="_blank">http://www.vtk.org/Wiki/VTK___<u></u>FAQ</a> &lt;<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a>&gt;<div class="im">
<br>
<br>
    Follow this link to subscribe/unsubscribe:<br></div>
    <a href="http://www.vtk.org/mailman/__listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/__<u></u>listinfo/vtkusers</a><br>
    &lt;<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a>&gt;<br>
<br>
<br>
</blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a><br>
</div></div></blockquote></div><br></div>