Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

NodePCRotation.h
Go to the documentation of this file.
1 
32 #pragma once
33 
36 
37 namespace ogdf::pc_tree {
45 protected:
46  const Graph* m_G;
48 
52 
53  NodePCRotation() : m_G(nullptr), m_n(nullptr) { }
54 
55 public:
64  explicit NodePCRotation(const Graph& G, node n, bool mapBundleEdges = true);
65 
66  static node getTrivialPartnerPole(const Graph& G, node n);
67 
73  node getTrivialPartnerPole() const;
74 
76  for (auto leaf : getLeaves()) {
77  mapping[getIncidentEdgeForLeaf(leaf)] = leaf;
78  }
79  }
80 
86  edge getIncidentEdgeForLeaf(PCNode* n) const { return m_incidentEdgeForLeaf[n]; }
87 
92  void setIncidentEdgeForLeaf(PCNode* n, edge e) { m_incidentEdgeForLeaf[n] = e; }
93 
95  for (auto leaf : getLeaves()) {
96  mapping[getGraphNodeForInnerNode(leaf)] = leaf;
97  }
98  }
99 
105  node getGraphNodeForInnerNode(PCNode* n) const { return m_graphNodeForInnerNode[n]; }
106 
108  for (auto leaf : getLeaves()) {
109  mapping[getIncidentEdgeForLeaf(leaf)] = &getPartnerEdgesForLeaf(leaf);
110  }
111  }
112 
121  const List<edge>& getPartnerEdgesForLeaf(PCNode* l) const { return m_bundleEdgesForLeaf[l]; }
122 
126  bool knowsPartnerEdges() const {
127  if (m_bundleEdgesForLeaf.registeredAt() == nullptr) {
128  return false;
129  } else {
130  return &m_bundleEdgesForLeaf.registeredAt()->getForest() == getForest();
131  }
132  }
133 
134  const Graph* getGraph() const { return m_G; }
135 
136  node getNode() const { return m_n; }
137 
143  bool isEqual(const NodePCRotation& pc) const;
144 
149  std::function<void(std::ostream& os, PCNode*, int)> uidPrinter() const;
150 
155  std::function<bool(PCNode*, PCNode*)> uidComparer() const;
156 };
157 
158 struct OGDF_EXPORT GraphNotPlanarException : public std::exception {
159 public:
160  [[nodiscard]] const char* what() const noexcept override { return "Graph is not planar"; }
161 };
162 }
ogdf::RegisteredArray
Dynamic arrays indexed with arbitrary keys.
Definition: RegisteredArray.h:808
ogdf::pc_tree::NodePCRotation::m_G
const Graph * m_G
Definition: NodePCRotation.h:46
RegisteredSet.h
Declaration and implementation of ogdf::RegisteredSet.
ogdf::pc_tree
Definition: NodePCRotation.h:37
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:109
ogdf::pc_tree::NodePCRotation::getGraphNodeForInnerNode
node getGraphNodeForInnerNode(PCNode *n) const
Returns which graph node created a P-node during the run of the planarity test that resulted in this ...
Definition: NodePCRotation.h:105
ogdf::pc_tree::NodePCRotation
This class represents the embedding tree of a single node in a biconnected component.
Definition: NodePCRotation.h:44
ogdf::pc_tree::NodePCRotation::generateInnerNodeForGraphNodeMapping
void generateInnerNodeForGraphNodeMapping(NodeArray< PCNode * > &mapping) const
Definition: NodePCRotation.h:94
ogdf::pc_tree::NodePCRotation::knowsPartnerEdges
bool knowsPartnerEdges() const
Definition: NodePCRotation.h:126
ogdf::pc_tree::NodePCRotation::m_graphNodeForInnerNode
PCTreeNodeArray< node > m_graphNodeForInnerNode
Definition: NodePCRotation.h:50
ogdf::pc_tree::NodePCRotation::getIncidentEdgeForLeaf
edge getIncidentEdgeForLeaf(PCNode *n) const
Returns which incident edge corresponds to which leaf.
Definition: NodePCRotation.h:86
ogdf::pc_tree::NodePCRotation::m_n
node m_n
Definition: NodePCRotation.h:47
ogdf::pc_tree::NodePCRotation::setIncidentEdgeForLeaf
void setIncidentEdgeForLeaf(PCNode *n, edge e)
This is only needed so that SyncPlan::propagatePQ can fix its mapping when propagating into an adjace...
Definition: NodePCRotation.h:92
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::pc_tree::NodePCRotation::getPartnerEdgesForLeaf
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...
Definition: NodePCRotation.h:121
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::pc_tree::NodePCRotation::generatePartnerEdgesForIncidentEdge
void generatePartnerEdgesForIncidentEdge(EdgeArray< const List< edge > * > &mapping) const
Definition: NodePCRotation.h:107
ogdf::pc_tree::NodePCRotation::getGraph
const Graph * getGraph() const
Definition: NodePCRotation.h:134
ogdf::pc_tree::GraphNotPlanarException
Definition: NodePCRotation.h:158
ogdf::pc_tree::PCNode
A node in a PC-tree that is either a P-node, C-node or leaf.
Definition: PCNode.h:58
ogdf::pc_tree::NodePCRotation::generateLeafForIncidentEdgeMapping
void generateLeafForIncidentEdgeMapping(EdgeArray< PCNode * > &mapping) const
Definition: NodePCRotation.h:75
ogdf::pc_tree::NodePCRotation::m_bundleEdgesForLeaf
PCTreeNodeArray< List< edge > > m_bundleEdgesForLeaf
Definition: NodePCRotation.h:51
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::pc_tree::NodePCRotation::NodePCRotation
NodePCRotation()
Definition: NodePCRotation.h:53
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::pc_tree::NodePCRotation::m_incidentEdgeForLeaf
PCTreeNodeArray< edge > m_incidentEdgeForLeaf
Definition: NodePCRotation.h:49
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::pc_tree::GraphNotPlanarException::what
const char * what() const noexcept override
Definition: NodePCRotation.h:160
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709
PCTree.h
The main class of the PC-tree.
ogdf::pc_tree::NodePCRotation::getNode
node getNode() const
Definition: NodePCRotation.h:136