Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

UpwardPlanRep.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/GraphCopy.h>
36 
37 namespace ogdf {
38 
39 
51 public:
53 
54 #if 0
55  //debug only
57 #endif
58 
59  /* @{
60  * \brief Creates a planarized representation with respect to \p Gamma.
61  * Gamma muss be an upward planar embedding with a fixed ext. face
62  * Precondition: the graph is a single source graph
63  */
64 
65  explicit UpwardPlanRep(
66  const CombinatorialEmbedding& Gamma); //upward planar embedding with a fixed ext. face
67 
68  UpwardPlanRep(const GraphCopy& GC, // must be upward embedded and single source
69  adjEntry adj_ext); // the right face of this adjEntry is the external face
70 
72  UpwardPlanRep(const UpwardPlanRep& UPR);
73 
76  : GraphCopy()
77  , isAugmented(false)
78  , t_hat(nullptr)
79  , s_hat(nullptr)
80  , extFaceHandle(nullptr)
81  , crossings(0)
82  // multisources(false)
83  {
84  m_Gamma.init(*this);
85  m_isSinkArc.init(*this, false);
86  m_isSourceArc.init(*this, false);
87  }
88 
89  virtual ~UpwardPlanRep() { }
90 
92  void insertEdgePathEmbedded(edge eOrig, SList<adjEntry> crossedEdges, EdgeArray<int>& cost);
93 
95  // pred. the graph muss be a sinlge source graph
96  // We construct node t and connect the sink-switches with t. The new arcs are sSinkArc.
97  // For simplicity we construct an additional edge (t,t_hat) (the extFaceArc), where t_hat is the super sink.
98  void augment();
99 
101  bool augmented() const { return isAugmented; }
102 
104  const CombinatorialEmbedding& getEmbedding() const { return m_Gamma; }
105 
106  CombinatorialEmbedding& getEmbedding() { return m_Gamma; }
107 
108  node getSuperSink() const { return t_hat; }
109 
110  node getSuperSource() const { return s_hat; }
111 
112  int numberOfCrossings() const { return crossings; }
113 
115  UpwardPlanRep& operator=(const UpwardPlanRep& copy);
116 
117  bool isSinkArc(edge e) const { return m_isSinkArc[e]; }
118 
119  bool isSourceArc(edge e) const { return m_isSourceArc[e]; }
120 
123  adjEntry sinkSwitchOf(node v) { return m_sinkSwitchOf[v]; }
124 
126  adjEntry getAdjEntry(const CombinatorialEmbedding& Gamma, node v, face f) const;
127 
128  //return the left in edge of node v.
130  if (v->indeg() == 0) {
131  return nullptr;
132  }
133 
134  adjEntry adjFound = nullptr;
135  for (adjEntry adj : v->adjEntries) {
136  if (adj->theEdge()->target() == v && adj->cyclicSucc()->theEdge()->source() == v) {
137  adjFound = adj;
138  break;
139  }
140  }
141  return adjFound;
142  }
143 
144  // debug
145  void outputFaces(const CombinatorialEmbedding& embedding) const {
146  std::cout << std::endl << "Face UPR " << std::endl;
147  for (face f : embedding.faces) {
148  std::cout << "face " << f->index() << ": ";
149  adjEntry adjNext = f->firstAdj();
150  do {
151  std::cout << adjNext->theEdge() << "; ";
152  adjNext = adjNext->faceCycleSucc();
153  } while (adjNext != f->firstAdj());
154  std::cout << std::endl;
155  }
156  if (embedding.externalFace() != nullptr) {
157  std::cout << "ext. face of the graph is: " << embedding.externalFace()->index()
158  << std::endl;
159  } else {
160  std::cout << "no ext. face set." << std::endl;
161  }
162  }
163 
164 
165 protected:
166  bool isAugmented;
167 
169 
171 
173 
174  // sinkArk are edges which are added to transform the original graph to single sink graph.
175  // note: the extFaceHandle is a sink arc.
177 
178  // source arc are edges which are added to transform the original graph to a single source graph
180 
181  // 0 if node v is not a non-top-sink-switch of a internal face.
182  // else v is (non-top) sink-switch of f (= right face of adjEntry).
184 
185  adjEntry extFaceHandle; // the right face of this adjEntry is always the ext. face
186 
188 
189 
190 private:
191  void computeSinkSwitches();
192 
194  void initMe();
195 
196  void copyMe(const UpwardPlanRep& UPR);
197 
198  void removeSinkArcs(SList<adjEntry>& crossedEdges);
199 
200  void constructSinkArcs(face f, node t);
201 };
202 
203 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::UpwardPlanRep::m_sinkSwitchOf
NodeArray< adjEntry > m_sinkSwitchOf
Definition: UpwardPlanRep.h:183
ogdf::UpwardPlanRep::augmented
bool augmented() const
return true if graph is augmented to a single source single sink graph
Definition: UpwardPlanRep.h:101
ogdf::SubgraphUpwardPlanarizer
Takes an acyclic connected non-upward-planar graph and planarizes it, i.e., we obtain an upward-plana...
Definition: SubgraphUpwardPlanarizer.h:67
ogdf::UpwardPlanRep::m_isSinkArc
EdgeArray< bool > m_isSinkArc
Definition: UpwardPlanRep.h:176
ogdf::UpwardPlanRep::crossings
int crossings
Definition: UpwardPlanRep.h:187
ogdf::SList
Singly linked lists (maintaining the length of the list).
Definition: SList.h:833
ogdf::UpwardPlanRep::~UpwardPlanRep
virtual ~UpwardPlanRep()
Definition: UpwardPlanRep.h:89
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:384
ogdf::UpwardPlanRep::sinkSwitchOf
adjEntry sinkSwitchOf(node v)
0 if node v is not a sink switch (not the top sink switch !!) of an internal face....
Definition: UpwardPlanRep.h:123
ogdf::UpwardPlanRep::numberOfCrossings
int numberOfCrossings() const
Definition: UpwardPlanRep.h:112
ogdf::UpwardPlanRep::extFaceHandle
adjEntry extFaceHandle
Definition: UpwardPlanRep.h:185
ogdf::UpwardPlanRep::UpwardPlanRep
UpwardPlanRep()
standart constructor
Definition: UpwardPlanRep.h:75
ogdf::FixedEmbeddingUpwardEdgeInserter
Edge insertion module that inserts each edge optimally into a fixed embedding.
Definition: FixedEmbeddingUpwardEdgeInserter.h:41
ogdf::UpwardPlanRep::getEmbedding
const CombinatorialEmbedding & getEmbedding() const
return the upward planar embedding
Definition: UpwardPlanRep.h:104
ogdf::UpwardPlanRep::isAugmented
bool isAugmented
the UpwardPlanRep is augmented to a single source and single sink graph
Definition: UpwardPlanRep.h:166
ogdf::UpwardPlanRep::m_isSourceArc
EdgeArray< bool > m_isSourceArc
Definition: UpwardPlanRep.h:179
ogdf::UpwardPlanRep::isSinkArc
bool isSinkArc(edge e) const
Definition: UpwardPlanRep.h:117
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::FaceElement::firstAdj
adjEntry firstAdj() const
Returns the first adjacency element in the face.
Definition: CombinatorialEmbedding.h:139
ogdf::UpwardPlanRep::t_hat
node t_hat
< embedding og this UpwardPlanRep
Definition: UpwardPlanRep.h:170
ogdf::UpwardPlanRep::leftInEdge
adjEntry leftInEdge(node v) const
Definition: UpwardPlanRep.h:129
ogdf::GraphCopyBase::init
void init(const Graph &G)
Re-initializes the copy using G, creating copies for all nodes and edges in G.
Definition: GraphCopy.h:66
ogdf::AdjElement::theEdge
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:153
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
ogdf::ConstCombinatorialEmbedding::faces
internal::GraphObjectContainer< FaceElement > faces
The container containing all face objects.
Definition: CombinatorialEmbedding.h:221
ogdf::NodeElement::adjEntries
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:264
ogdf::UpwardPlanRep::s_hat
node s_hat
the super source
Definition: UpwardPlanRep.h:172
ogdf::NodeElement::indeg
int indeg() const
Returns the indegree of the node.
Definition: Graph_d.h:270
ogdf::EdgeElement::source
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:391
GraphCopy.h
Declaration of graph copy classes.
ogdf::UpwardPlanRep::getSuperSink
node getSuperSink() const
Definition: UpwardPlanRep.h:108
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::AdjElement::cyclicSucc
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
Definition: Graph_d.h:347
ogdf::ConstCombinatorialEmbedding::externalFace
face externalFace() const
Returns the external face.
Definition: CombinatorialEmbedding.h:295
ogdf::FaceElement::index
int index() const
Returns the index of the face.
Definition: CombinatorialEmbedding.h:136
ogdf::UpwardPlanRep::m_Gamma
CombinatorialEmbedding m_Gamma
Definition: UpwardPlanRep.h:168
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:397
ogdf::AdjElement::faceCycleSucc
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
Definition: Graph_d.h:205
ogdf::UpwardPlanRep::outputFaces
void outputFaces(const CombinatorialEmbedding &embedding) const
Definition: UpwardPlanRep.h:145
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::UpwardPlanRep
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:50
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:394
ogdf::UpwardPlanRep::isSourceArc
bool isSourceArc(edge e) const
Definition: UpwardPlanRep.h:119
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::UpwardPlanRep::getEmbedding
CombinatorialEmbedding & getEmbedding()
Definition: UpwardPlanRep.h:106
ogdf::UpwardPlanRep::getSuperSource
node getSuperSource() const
Definition: UpwardPlanRep.h:110
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709
ogdf::FaceElement
Faces in a combinatorial embedding.
Definition: CombinatorialEmbedding.h:109