VTK  9.4.20241217
vtkTree.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
145#ifndef vtkTree_h
146#define vtkTree_h
147
148#include "vtkCommonDataModelModule.h" // For export macro
150
151VTK_ABI_NAMESPACE_BEGIN
152class vtkIdTypeArray;
153
154class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
155{
156public:
157 static vtkTree* New();
159 void PrintSelf(ostream& os, vtkIndent indent) override;
160
164 int GetDataObjectType() override { return VTK_TREE; }
165
167
170 vtkGetMacro(Root, vtkIdType);
172
177
182
189
194
199
206
210 bool IsLeaf(vtkIdType vertex);
211
213
217 static vtkTree* GetData(vtkInformationVector* v, int i = 0);
219
226 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
227
228protected:
230 ~vtkTree() override;
231
236 bool IsStructureValid(vtkGraph* g) override;
237
242
243private:
244 vtkTree(const vtkTree&) = delete;
245 void operator=(const vtkTree&) = delete;
246};
247
248VTK_ABI_NAMESPACE_END
249#endif
Iterates through adjacent vertices in a graph.
A rooted tree data structure.
Base class for graph data types.
Definition vtkGraph.h:340
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
Initializes the adjacent vertex iterator to iterate over all outgoing vertices from vertex v.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A rooted tree data structure.
Definition vtkTree.h:155
vtkIdType GetChild(vtkIdType v, vtkIdType i)
Get the i-th child of a parent vertex.
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition vtkTree.h:176
static vtkTree * GetData(vtkInformationVector *v, int i=0)
Retrieve a graph from an information vector.
virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children)
Reorder the children of a parent vertex.
static vtkTree * New()
vtkEdgeType GetParentEdge(vtkIdType v)
Get the edge connecting the vertex to its parent.
static vtkTree * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition vtkTree.h:188
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType Root
The root of the tree.
Definition vtkTree.h:241
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
int GetDataObjectType() override
Return what type of dataset this is.
Definition vtkTree.h:164
vtkIdType GetLevel(vtkIdType v)
Get the level of the vertex in the tree.
bool IsLeaf(vtkIdType vertex)
Return whether the vertex is a leaf (i.e.
~vtkTree() override
int vtkIdType
Definition vtkType.h:315
#define VTK_TREE
Definition vtkType.h:86