FreeMat

- Main Page
- Related Pages

vtkTreeDFSIterator

Section: Visualization Toolkit Filtering Classes

# Usage

vtkTreeDFSIterator performs a depth first seedgeh of a tree. First, you must set the tree on which you are going to iterate, and set the starting vertex and mode. The mode is either DISCOVER, in which case vertices are visited as they are first reached, or FINISH, in which case vertices are visited when they are done, i.e. all adjacent vertices have been discovered already.

After setting up the iterator, the normal mode of operation is to set up a `while(iter->HasNext())` loop, with the statement `vtkIdType vertex = iter->Next()` inside the loop.

To create an instance of class vtkTreeDFSIterator, simply invoke its constructor as follows

      obj = vtkTreeDFSIterator

# Methods

The class vtkTreeDFSIterator has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkTreeDFSIterator class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkTreeDFSIterator = obj.NewInstance ()`
- `vtkTreeDFSIterator = obj.SafeDownCast (vtkObject o)`
- `obj.SetTree (vtkTree graph)` - Set the graph to iterate over.
- `obj.SetMode (int mode)` - Set the visit mode of the iterator. Mode can be DISCOVER (0): Order by discovery time FINISH (1): Order by finish time Default is DISCOVER. Use DISCOVER for top-down algorithms where parents need to be processed before children. Use FINISH for bottom-up algorithms where children need to be processed before parents.
- `int = obj.GetMode ()` - Set the visit mode of the iterator. Mode can be DISCOVER (0): Order by discovery time FINISH (1): Order by finish time Default is DISCOVER. Use DISCOVER for top-down algorithms where parents need to be processed before children. Use FINISH for bottom-up algorithms where children need to be processed before parents.
- `obj.SetStartVertex (vtkIdType vertex)` - The start vertex of the seedgeh. The tree iterator will only iterate over the subtree rooted at vertex. If not set (or set to a negative value), starts at the root of the tree.
- `vtkIdType = obj.GetStartVertex ()` - The start vertex of the seedgeh. The tree iterator will only iterate over the subtree rooted at vertex. If not set (or set to a negative value), starts at the root of the tree.
- `vtkIdType = obj.Next ()` - The next vertex visited in the graph.
- `bool = obj.HasNext ()` - Return true when all vertices have been visited.