Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
47 namespace ogdf::pc_tree {
55 protected:
56  const Graph* m_G;
58 
62 
63  NodePCRotation() : m_G(nullptr), m_n(nullptr) { }
64 
65 public:
74  explicit NodePCRotation(const Graph& G, node n, bool mapBundleEdges = true);
75 
76  static node getTrivialPartnerPole(const Graph& G, node n);
77 
83  node getTrivialPartnerPole() const;
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 
168 struct OGDF_EXPORT GraphNotPlanarException : public std::exception {
169 public:
170  [[nodiscard]] const char* what() const noexcept override { return "Graph is not planar"; }
171 };
172 }
ogdf::RegisteredArray
Dynamic arrays indexed with arbitrary keys.
Definition: RegisteredArray.h:817
ogdf::pc_tree::NodePCRotation::m_G
const Graph * m_G
Definition: NodePCRotation.h:56
Graph.h
Includes declaration of graph class.
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
IntrusiveList.h
An intrusive list for the leaves of a PCTree. TODO should be moved to a central location; merge with ...
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:115
ogdf::pc_tree::NodePCRotation
This class represents the embedding tree of a single node in a biconnected component.
Definition: NodePCRotation.h:54
ogdf::pc_tree::NodePCRotation::generateInnerNodeForGraphNodeMapping
void generateInnerNodeForGraphNodeMapping(NodeArray< PCNode * > &mapping) const
Definition: NodePCRotation.h:104
ogdf::pc_tree::NodePCRotation::knowsPartnerEdges
bool knowsPartnerEdges() const
Definition: NodePCRotation.h:136
ogdf::pc_tree::NodePCRotation::m_graphNodeForInnerNode
PCTreeNodeArray< node > m_graphNodeForInnerNode
Definition: NodePCRotation.h:60
ogdf::pc_tree::NodePCRotation::getIncidentEdgeForLeaf
edge getIncidentEdgeForLeaf(PCNode *n) const
Returns which incident edge corresponds to which leaf.
Definition: NodePCRotation.h:96
PCRegistry.h
A registry that allows labelling the nodes of a PC-tree.
ogdf::pc_tree::NodePCRotation::m_n
node m_n
Definition: NodePCRotation.h:57
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:102
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
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:131
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::pc_tree::NodePCRotation::generatePartnerEdgesForIncidentEdge
void generatePartnerEdgesForIncidentEdge(EdgeArray< const List< edge > * > &mapping) const
Definition: NodePCRotation.h:117
ogdf::pc_tree::NodePCRotation::getGraph
const Graph * getGraph() const
Definition: NodePCRotation.h:144
PCEnum.h
Predeclaration of various PC-tree related classes and enums.
ogdf::pc_tree::GraphNotPlanarException
Definition: NodePCRotation.h:168
ogdf::pc_tree::PCNode
A node in a PC-tree that is either a P-node, C-node or leaf.
Definition: PCNode.h:62
PCNode.h
A node in a PC-tree that is either a P-node, C-node or leaf.
basic.h
Basic declarations, included by all source files.
ogdf::pc_tree::NodePCRotation::generateLeafForIncidentEdgeMapping
void generateLeafForIncidentEdgeMapping(EdgeArray< PCNode * > &mapping) const
Definition: NodePCRotation.h:85
ogdf::pc_tree::NodePCRotation::m_bundleEdgesForLeaf
PCTreeNodeArray< List< edge > > m_bundleEdgesForLeaf
Definition: NodePCRotation.h:61
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:63
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
List.h
Declaration of doubly linked lists and iterators.
ogdf::pc_tree::NodePCRotation::m_incidentEdgeForLeaf
PCTreeNodeArray< edge > m_incidentEdgeForLeaf
Definition: NodePCRotation.h:59
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::pc_tree::GraphNotPlanarException::what
const char * what() const noexcept override
Definition: NodePCRotation.h:170
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
PCTree.h
The main class of the PC-tree.
ogdf::pc_tree::NodePCRotation::getNode
node getNode() const
Definition: NodePCRotation.h:146