[vtkusers] Allowing repeated vertices in a tree
Tim Gallagher
tim.gallagher at gatech.edu
Mon Oct 12 13:04:15 EDT 2015
Hi,
I have a structured grid that I made into a vtkMutableDirectedGraph and at various points I convert it into a tree using the vtkBoostBreadthFirstSearchTree. I use the output of that filter to do a search with either the vtkTreeDFSIterator or vtkTreeBFSIterator. Everything is going well until one branch of the tree search ends early.
For example, assume that I have 4 nodes that make up a square. These nodes are indexed by their (i,j) locations -- so (0,0) is the lower left corner, (1,0) is the lower right corner, (0,1) the upper left corner and (1,1) the upper right corner. When I build my directed graph, I set the edges:
(0,0)->(1,0)
(0,0)->(0,1)
(1,0)->(1,1)
(0,1)->(1,1)
Now I want to use my search tree to find the paths from (0,0) to (1,1). The search will correctly report one path:
(0,0)->(0,1)->(1,1)
but the second path ends one vertex early:
(0,0)->(1,0)
which I assume is because the tree does not allow a vertex to have multiple connections.
Is there a way to allow the (1,1) node to be included in both branches so I can get the complete path? Right now, when IsLeaf() == True and I am not on a node where the path is supposed to end, I manually follow the only remaining out edge in my original graph to find the proper end point. But it would be nice/clearer if the tree search wouldn't report a leaf node early.
Thanks,
Tim
More information about the vtkusers
mailing list