Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PCTreeForest.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/basic.h>
37 
38 #include <cstddef>
39 #include <limits>
40 #include <vector>
41 
42 namespace ogdf::pc_tree {
43 class PCNode;
44 class PCTree;
45 } // namespace ogdf::pc_tree
46 
47 #define OGDF_PCTREE_REUSE_NODES
48 
49 namespace ogdf::pc_tree {
50 using UnionFindIndex = size_t;
51 
52 const UnionFindIndex UNIONFINDINDEX_EMPTY = std::numeric_limits<UnionFindIndex>::max();
53 
60  friend class PCNode;
61  friend class PCTree;
62  friend class PCTreeRegistry;
63 
64 private:
65  std::vector<PCTree*> m_trees;
66  std::vector<PCNode*> m_cNodes;
67  ogdf::DisjointSets<> m_parents {1 << 8};
68  int m_nextNodeId = 0;
69  size_t m_timestamp = 0;
72 
73 #ifdef OGDF_PCTREE_REUSE_NODES
74  PCNode* m_reusableNodes = nullptr;
75 #endif
76 
77 public:
83  PCTreeForest(bool autodelete = true) : m_nodeArrayRegistry(this), m_autodelete(autodelete) {};
84 
85  virtual ~PCTreeForest();
86 
88  PCTree* makeTree(void);
89 
91  void clear(void);
92 
93  operator const PCTreeRegistry&() const { return m_nodeArrayRegistry; }
94 };
95 }
ogdf::pc_tree::PCTreeForest::PCTreeForest
PCTreeForest(bool autodelete=true)
Definition: PCTreeForest.h:83
ogdf::pc_tree
Definition: NodePCRotation.h:47
ogdf::pc_tree::PCTree
A PC-tree represents a set of cyclic orders of its leaves by labeling its inner nodes as either P- or...
Definition: PCTree.h:118
ogdf::pc_tree::PCTreeRegistry
A registry that allows labelling the nodes of a PC-tree.
Definition: PCRegistry.h:44
ogdf::pc_tree::PCTreeForest::m_nodeArrayRegistry
PCTreeRegistry m_nodeArrayRegistry
Definition: PCTreeForest.h:70
ogdf::pc_tree::PCTreeForest
Multiple PCTrees can be created within the same PCTreeForest, which allows merging the trees later on...
Definition: PCTreeForest.h:59
ogdf::DisjointSets
A Union/Find data structure for maintaining disjoint sets.
Definition: DisjointSets.h:90
ogdf::pc_tree::PCTreeForest::m_cNodes
std::vector< PCNode * > m_cNodes
Definition: PCTreeForest.h:66
PCRegistry.h
A registry that allows labelling the nodes of a PC-tree.
ogdf::pc_tree::UNIONFINDINDEX_EMPTY
const UnionFindIndex UNIONFINDINDEX_EMPTY
Definition: PCTreeForest.h:52
ogdf::pc_tree::UnionFindIndex
size_t UnionFindIndex
Definition: PCTreeForest.h:50
ogdf::pc_tree::PCNode
A node in a PC-tree that is either a P-node, C-node or leaf.
Definition: PCNode.h:62
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::pc_tree::PCTreeForest::m_trees
std::vector< PCTree * > m_trees
Definition: PCTreeForest.h:65
DisjointSets.h
Implementation of disjoint sets data structures (union-find functionality).
ogdf::pc_tree::PCTreeForest::m_autodelete
bool m_autodelete
Definition: PCTreeForest.h:71