Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
42namespace ogdf::pc_tree {
43class PCNode;
44class PCTree;
45} // namespace ogdf::pc_tree
46
47#define OGDF_PCTREE_REUSE_NODES
48
49namespace ogdf::pc_tree {
50using UnionFindIndex = size_t;
51
52const UnionFindIndex UNIONFINDINDEX_EMPTY = std::numeric_limits<UnionFindIndex>::max();
53
60 friend class PCNode;
61 friend class PCTree;
62 friend class PCTreeRegistry;
63
64private:
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
77public:
83 PCTreeForest(bool autodelete = true) : m_nodeArrayRegistry(this), m_autodelete(autodelete) {};
84
85 virtual ~PCTreeForest();
86
89
91 void clear(void);
92
93 operator const PCTreeRegistry&() const { return m_nodeArrayRegistry; }
94};
95}
Implementation of disjoint sets data structures (union-find functionality).
A registry that allows labelling the nodes of a PC-tree.
Basic declarations, included by all source files.
A Union/Find data structure for maintaining disjoint sets.
A node in a PC-tree that is either a P-node, C-node or leaf.
Definition PCNode.h:62
Multiple PCTrees can be created within the same PCTreeForest, which allows merging the trees later on...
void clear(void)
Delete all trees created by makeTree().
PCTreeRegistry m_nodeArrayRegistry
PCTreeForest(bool autodelete=true)
std::vector< PCNode * > m_cNodes
PCTree * makeTree(void)
Create a new tree that may be automatically deleted when this forest is deleted.
std::vector< PCTree * > m_trees
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
A registry that allows labelling the nodes of a PC-tree.
Definition PCRegistry.h:44
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
size_t UnionFindIndex
const UnionFindIndex UNIONFINDINDEX_EMPTY