VTK
|
A rooted tree data structure. More...
#include <vtkTree.h>
Public Types | |
typedef vtkDirectedAcyclicGraph | Superclass |
![]() | |
typedef vtkDirectedGraph | Superclass |
![]() | |
typedef vtkGraph | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual int | GetDataObjectType () |
vtkIdType | GetChild (vtkIdType v, vtkIdType i) |
vtkIdType | GetParent (vtkIdType v) |
vtkIdType | GetLevel (vtkIdType v) |
bool | IsLeaf (vtkIdType vertex) |
virtual void | ReorderChildren (vtkIdType parent, vtkIdTypeArray *children) |
virtual vtkIdType | GetRoot () |
vtkIdType | GetNumberOfChildren (vtkIdType v) |
void | GetChildren (vtkIdType v, vtkAdjacentVertexIterator *it) |
vtkEdgeType | GetParentEdge (vtkIdType v) |
![]() | |
void | PrintSelf (ostream &os, vtkIndent indent) |
![]() | |
void | PrintSelf (ostream &os, vtkIndent indent) |
Static Public Member Functions | |
static vtkTree * | New () |
static int | IsTypeOf (const char *type) |
static vtkTree * | SafeDownCast (vtkObject *o) |
static vtkTree * | GetData (vtkInformation *info) |
static vtkTree * | GetData (vtkInformationVector *v, int i=0) |
![]() | |
static vtkDirectedAcyclicGraph * | New () |
static int | IsTypeOf (const char *type) |
static vtkDirectedAcyclicGraph * | SafeDownCast (vtkObject *o) |
static vtkDirectedAcyclicGraph * | GetData (vtkInformation *info) |
static vtkDirectedAcyclicGraph * | GetData (vtkInformationVector *v, int i=0) |
![]() | |
static vtkDirectedGraph * | New () |
static int | IsTypeOf (const char *type) |
static vtkDirectedGraph * | SafeDownCast (vtkObject *o) |
static vtkDirectedGraph * | GetData (vtkInformation *info) |
static vtkDirectedGraph * | GetData (vtkInformationVector *v, int i=0) |
Protected Member Functions | |
vtkTree () | |
~vtkTree () | |
virtual bool | IsStructureValid (vtkGraph *g) |
![]() | |
vtkDirectedAcyclicGraph () | |
~vtkDirectedAcyclicGraph () | |
![]() | |
vtkDirectedGraph () | |
~vtkDirectedGraph () | |
Protected Attributes | |
vtkIdType | Root |
A rooted tree data structure.
vtkTree is a connected directed graph with no cycles. A tree is a type of directed graph, so works with all graph algorithms.
vtkTree is a read-only data structure. To construct a tree, create an instance of vtkMutableDirectedGraph. Add vertices and edges with AddVertex() and AddEdge(). You may alternately start by adding a single vertex as the root then call graph->AddChild(parent) which adds a new vertex and connects the parent to the child. The tree MUST have all edges in the proper direction, from parent to child. After building the tree, call tree->CheckedShallowCopy(graph) to copy the structure into a vtkTree. This method will return false if the graph is an invalid tree.
vtkTree provides some convenience methods for obtaining the parent and children of a vertex, for finding the root, and determining if a vertex is a leaf (a vertex with no children).
|
protected |
|
protected |
|
static |
|
virtual |
Reimplemented from vtkDirectedAcyclicGraph.
|
static |
|
virtual |
Reimplemented from vtkDirectedAcyclicGraph.
void vtkTree::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) |
|
inlinevirtual |
Return what type of dataset this is.
Reimplemented from vtkDirectedAcyclicGraph.
|
virtual |
Get the root vertex of the tree.
|
inline |
vtkEdgeType vtkTree::GetParentEdge | ( | vtkIdType | v) |
Get the edge connecting the vertex to its parent.
Get the level of the vertex in the tree. The root vertex has level 0. Returns -1 if the vertex id is < 0 or greater than the number of vertices in the tree.
bool vtkTree::IsLeaf | ( | vtkIdType | vertex) |
Return whether the vertex is a leaf (i.e. it has no children).
|
static |
Retrieve a graph from an information vector.
|
static |
Retrieve a graph from an information vector.
|
virtual |
Reorder the children of a parent vertex. The children array must contain all the children of parent, just in a different order. This does not change the topology of the tree.
|
protectedvirtual |
Check the storage, and accept it if it is a valid tree.
Reimplemented from vtkDirectedAcyclicGraph.