VTK  9.3.20240328
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
135 #ifndef vtkTree_h
136 #define vtkTree_h
137 
138 #include "vtkCommonDataModelModule.h" // For export macro
139 #include "vtkDirectedAcyclicGraph.h"
140 
141 VTK_ABI_NAMESPACE_BEGIN
142 class vtkIdTypeArray;
143 
144 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
145 {
146 public:
147  static vtkTree* New();
149  void PrintSelf(ostream& os, vtkIndent indent) override;
150 
154  int GetDataObjectType() override { return VTK_TREE; }
155 
157 
160  vtkGetMacro(Root, vtkIdType);
162 
167 
172 
179 
184 
189 
196 
200  bool IsLeaf(vtkIdType vertex);
201 
203 
207  static vtkTree* GetData(vtkInformationVector* v, int i = 0);
209 
216  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
217 
218 protected:
220  ~vtkTree() override;
221 
226  bool IsStructureValid(vtkGraph* g) override;
227 
232 
233 private:
234  vtkTree(const vtkTree&) = delete;
235  void operator=(const vtkTree&) = delete;
236 };
237 
238 VTK_ABI_NAMESPACE_END
239 #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:145
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.
static vtkTree * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:166
virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children)
Reorder the children of a parent vertex.
vtkEdgeType GetParentEdge(vtkIdType v)
Get the edge connecting the vertex to its parent.
static vtkTree * New()
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:178
static vtkTree * GetData(vtkInformationVector *v, int i=0)
Retrieve a graph from an information vector.
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:231
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:154
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
@ info
Definition: vtkX3D.h:376
int vtkIdType
Definition: vtkType.h:315
#define VTK_TREE
Definition: vtkType.h:86