Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
NodePCRotation.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
35#include <ogdf/basic/List.h>
36#include <ogdf/basic/basic.h>
42
43#include <exception>
44#include <functional>
45#include <iosfwd>
46
47namespace ogdf::pc_tree {
55protected:
56 const Graph* m_G;
58
62
63 NodePCRotation() : m_G(nullptr), m_n(nullptr) { }
64
65public:
74 explicit NodePCRotation(const Graph& G, node n, bool mapBundleEdges = true);
75
76 static node getTrivialPartnerPole(const Graph& G, node n);
77
84
86 for (auto leaf : getLeaves()) {
87 mapping[getIncidentEdgeForLeaf(leaf)] = leaf;
88 }
89 }
90
96 edge getIncidentEdgeForLeaf(PCNode* n) const { return m_incidentEdgeForLeaf[n]; }
97
102 void setIncidentEdgeForLeaf(PCNode* n, edge e) { m_incidentEdgeForLeaf[n] = e; }
103
105 for (auto leaf : getLeaves()) {
106 mapping[getGraphNodeForInnerNode(leaf)] = leaf;
107 }
108 }
109
115 node getGraphNodeForInnerNode(PCNode* n) const { return m_graphNodeForInnerNode[n]; }
116
118 for (auto leaf : getLeaves()) {
119 mapping[getIncidentEdgeForLeaf(leaf)] = &getPartnerEdgesForLeaf(leaf);
120 }
121 }
122
131 const List<edge>& getPartnerEdgesForLeaf(PCNode* l) const { return m_bundleEdgesForLeaf[l]; }
132
136 bool knowsPartnerEdges() const {
137 if (m_bundleEdgesForLeaf.registeredAt() == nullptr) {
138 return false;
139 } else {
140 return &m_bundleEdgesForLeaf.registeredAt()->getForest() == getForest();
141 }
142 }
143
144 const Graph* getGraph() const { return m_G; }
145
146 node getNode() const { return m_n; }
147
153 bool isEqual(const NodePCRotation& pc) const;
154
159 std::function<void(std::ostream& os, PCNode*, int)> uidPrinter() const;
160
165 std::function<bool(PCNode*, PCNode*)> uidComparer() const;
166};
167
168struct OGDF_EXPORT GraphNotPlanarException : public std::exception {
169public:
170 [[nodiscard]] const char* what() const noexcept override { return "Graph is not planar"; }
171};
172}
Includes declaration of graph class.
An intrusive list for the leaves of a PCTree.
Declaration of doubly linked lists and iterators.
Predeclaration of various PC-tree related classes and enums.
A node in a PC-tree that is either a P-node, C-node or leaf.
A registry that allows labelling the nodes of a PC-tree.
The main class of the PC-tree.
Basic declarations, included by all source files.
Class for the representation of edges.
Definition Graph_d.h:364
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
Dynamic arrays indexed with arbitrary keys.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
This class represents the embedding tree of a single node in a biconnected component.
void generateLeafForIncidentEdgeMapping(EdgeArray< PCNode * > &mapping) const
void generatePartnerEdgesForIncidentEdge(EdgeArray< const List< edge > * > &mapping) const
std::function< bool(PCNode *, PCNode *)> uidComparer() const
node getTrivialPartnerPole() const
If this embedding tree is trivial (i.e., consists of a single P-node allowing arbitrary rotations),...
PCTreeNodeArray< List< edge > > m_bundleEdgesForLeaf
std::function< void(std::ostream &os, PCNode *, int)> uidPrinter() const
PCTreeNodeArray< node > m_graphNodeForInnerNode
void generateInnerNodeForGraphNodeMapping(NodeArray< PCNode * > &mapping) const
node getGraphNodeForInnerNode(PCNode *n) const
Returns which graph node created a P-node during the run of the planarity test that resulted in this ...
PCTreeNodeArray< edge > m_incidentEdgeForLeaf
static node getTrivialPartnerPole(const Graph &G, node n)
const Graph * getGraph() const
edge getIncidentEdgeForLeaf(PCNode *n) const
Returns which incident edge corresponds to which leaf.
bool isEqual(const NodePCRotation &pc) const
Equality check where to leaves are considered the same if they map to the same edge via getIncidentEd...
NodePCRotation(const Graph &G, node n, bool mapBundleEdges=true)
Calculate the embedding tree of node n in graph G.
const List< edge > & getPartnerEdgesForLeaf(PCNode *l) const
If this embedding tree is trivial and getNode() thus has a partner pole, returns the set of edges inc...
void setIncidentEdgeForLeaf(PCNode *n, edge e)
This is only needed so that SyncPlan::propagatePQ can fix its mapping when propagating into an adjace...
A node in a PC-tree that is either a P-node, C-node or leaf.
Definition PCNode.h:62
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
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
const char * what() const noexcept override