VTK  9.5.20250706
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
151
152VTK_ABI_NAMESPACE_BEGIN
153class vtkIdTypeArray;
154
155class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkTree : public vtkDirectedAcyclicGraph
156{
157public:
158 static vtkTree* New();
160 void PrintSelf(ostream& os, vtkIndent indent) override;
161
165 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_TREE; }
166
168
171 vtkGetMacro(Root, vtkIdType);
172 vtkSetMacro(Root, vtkIdType);
174
179
184
191
196
201
208
212 bool IsLeaf(vtkIdType vertex);
213
215
219 static vtkTree* GetData(vtkInformationVector* v, int i = 0);
221
228 virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
229
230protected:
232 ~vtkTree() override;
233
238 bool IsStructureValid(vtkGraph* g) override;
239
244
245private:
246 vtkTree(const vtkTree&) = delete;
247 void operator=(const vtkTree&) = delete;
248};
249
250VTK_ABI_NAMESPACE_END
251#endif
Iterates through adjacent vertices in a graph.
A rooted tree data structure.
Base class for graph data types.
Definition vtkGraph.h:342
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:156
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
Definition vtkTree.h:165
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:178
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:190
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:243
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
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:332
@ VTK_TREE
Definition vtkType.h:101
#define VTK_MARSHALAUTO