Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

PlanRepExpansion.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/tuples.h>
37 #include <ogdf/basic/SList.h>
38 
40 #include <ogdf/basic/FaceSet.h>
41 #include <ogdf/basic/NodeSet.h>
42 
43 
44 namespace ogdf {
45 
55 {
56 public:
57  struct Crossing {
58  Crossing() { m_adj = nullptr; }
59  explicit Crossing(adjEntry adj) { m_adj = adj; }
60 
64 
65  friend std::ostream &operator<<(std::ostream &os, const Crossing &c) {
66  os << "(" << c.m_adj << ")";
67  return os;
68  }
69  };
70 
71 
78  class NodeSplit
79  {
80  public:
84  NodeSplit() { }
85 
89  explicit NodeSplit(ListIterator<NodeSplit> it) : m_nsIterator(it) { }
90 
94  node source() const { return m_path.front()->source(); }
95 
99  node target() const { return m_path.back ()->target(); }
100 
103  };
104 
107 
108 
114  PlanRepExpansion(const Graph& G);
115 
123  PlanRepExpansion(const Graph& G, const List<node> &splittableNodes);
124 
126 
127 
132 
134  const Graph &original() const { return *m_pGraph; }
135 
137  node original(node v) const { return m_vOrig[v]; }
138 
140  const List<node> &expansion(node vOrig) const { return m_vCopy[vOrig]; }
141 
143  node copy(node vOrig) const { return m_vCopy[vOrig].front(); }
144 
146  edge originalEdge(edge e) const { return m_eOrig[e]; }
147 
149  const List<edge> &chain(edge eOrig) const { return m_eCopy[eOrig]; }
150 
152  edge copy(edge eOrig) const { return m_eCopy[eOrig].front(); }
153 
155  bool splittable(node v) const { return m_splittable[v]; }
156 
158  bool splittableOrig(node vOrig) const { return m_splittableOrig[vOrig]; }
159 
161  NodeSplit *nodeSplitOf(edge e) const { return m_eNodeSplit[e]; }
162 
164  int numberOfNodeSplits() const { return m_nodeSplits.size(); }
165  int numberOfSplittedNodes() const;
166 
168  List<NodeSplit> &nodeSplits() { return m_nodeSplits; }
169 
179  List<edge> &setOrigs(edge e, edge &eOrig, nodeSplit &ns);
180 
181  ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
182 
183  bool isPseudoCrossing(node v) const;
184 
186  int computeNumberOfCrossings() const;
187 
189 
193 
194 
198  int numberOfCCs() const {
199  return m_nodesInCC.size();
200  }
201 
205  int currentCC() const {
206  return m_currentCC;
207  }
208 
214  const List<node> &nodesInCC(int i) const {
215  return m_nodesInCC[i];
216  }
217 
221  const List<node> &nodesInCC() const {
222  return m_nodesInCC[m_currentCC];
223  }
224 
233  void initCC(int i);
234 
235 
237 
241 
242  edge split(edge e) override;
243 
244  void unsplit(edge eIn, edge eOut) override;
245 
247  virtual void delEdge(edge e) override;
248 
250  bool embed();
251 
252  void insertEdgePath(
253  edge eOrig,
254  nodeSplit ns,
255  node vStart,
256  node vEnd,
257  List<Crossing> &eip,
258  edge eSrc,
259  edge eTgt);
260 
273  void insertEdgePathEmbedded(
274  edge eOrig,
275  nodeSplit ns,
277  const List<Tuple2<adjEntry,adjEntry> > &crossedEdges);
278 
292  void removeEdgePathEmbedded(
294  edge eOrig,
295  nodeSplit ns,
296  FaceSet<false> &newFaces,
297  NodeSet<false> &mergedNodes,
298  node &oldSrc,
299  node &oldTgt);
300 
310  void removeEdgePath(
311  edge eOrig,
312  nodeSplit ns,
313  node &oldSrc,
314  node &oldTgt);
315 
324  void contractSplit(nodeSplit ns, CombinatorialEmbedding &E);
325 
333  void contractSplit(nodeSplit ns);
334 
345  edge unsplitExpandNode(
346  node u,
347  edge eContract,
348  edge eExpand,
350 
360  edge unsplitExpandNode(
361  node u,
362  edge eContract,
363  edge eExpand);
364 
376  edge enlargeSplit(node v, edge e, CombinatorialEmbedding &E);
377 
388  edge enlargeSplit(node v, edge e);
389 
399  edge splitNodeSplit(edge e, CombinatorialEmbedding &E);
400 
409  edge splitNodeSplit(edge e);
410 
419  void removeSelfLoop(edge e, CombinatorialEmbedding &E);
420 
421  void removeSelfLoop(edge e);
422 
434  PlanRepExpansion::nodeSplit convertDummy(
435  node u,
436  node vOrig,
438 
439  edge separateDummy(
440  adjEntry adj_1,
441  adjEntry adj_2,
442  node vStraight,
443  bool isSrc);
444 
445  void resolvePseudoCrossing(node v);
446 
448 
452 
453 #ifdef OGDF_DEBUG
454  void consistencyCheck() const;
455 #endif
456 
458 
459 private:
460  void doInit(const Graph &G, const List<node> &splittableNodes);
461  void prepareNodeSplit(
462  const SList<adjEntry> &partitionLeft,
463  adjEntry &adjLeft,
464  adjEntry &adjRight);
465 
466  const Graph *m_pGraph;
473 
478 
480  int m_numCC;
481 
484 };
485 
486 }
Declaration of singly linked lists and iterators.
Representation of a node split in a planarized expansion.
EdgeArray< NodeSplit * > m_eNodeSplit
node target() const
Returns the last node on the node split&#39;s insertion path.
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:200
ListConstIterator< edge > position(edge e) const
EdgeArray< edge > m_eOrig
The corresponding edge in the original graph.
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
NodeArray< bool > m_splittableOrig
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
ListIterator< NodeSplit > m_nsIterator
This node split&#39;s iterator in the list of all node splits.
const Graph & original() const
Returns a reference to the original graph.
NodeArray< node > m_vOrig
The corresponding node in the original graph.
Planarized representations (of a connected component) of a graph.
List< NodeSplit > & nodeSplits()
Returns the list of node splits.
Declaration of CombinatorialEmbedding and face.
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
node original(node v) const
Returns the original node of v, or 0 if v is a dummy.
Singly linked lists (maintaining the length of the list).
Definition: SList.h:773
bool splittableOrig(node vOrig) const
Returns true iff vOrig is splittable.
int m_numCC
The number of components in the original graph.
NodeArray< ListIterator< node > > m_vIterator
The position of copy node in the list.
EdgeArray< edge > m_eAuxCopy
int m_currentCC
The index of the current component.
List< edge > m_path
The insertion path of the node split.
int numberOfNodeSplits() const
Returns the number of node splits.
const List< node > & nodesInCC(int i) const
Returns the list of (original) nodes in connected component i.
const List< node > & nodesInCC() const
Returns the list of (original) nodes in the current connected component.
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:438
EdgeArray< List< edge > > m_eCopy
The corresponding list of edges in the graph copy.
int currentCC() const
Returns the index of the current connected component (-1 if not yet initialized). ...
Tuples of two elements (2-tuples).
Definition: tuples.h:46
EdgeArray< ListIterator< edge > > m_eIterator
The position of copy edge in the list.
NodeArray< List< node > > m_vCopy
The corresponding list of nodes in the graph copy.
Array< List< node > > m_nodesInCC
The list of original nodes in each component.
Class for the representation of edges.
Definition: Graph_d.h:292
edge copy(edge eOrig) const
Returns the first edge in eOrig&#39;s insertion path.
Class for the representation of nodes.
Definition: Graph_d.h:169
const List< node > & expansion(node vOrig) const
Returns the list of copy nodes of vOrig.
friend std::ostream & operator<<(std::ostream &os, const Crossing &c)
NodeArray< bool > m_splittable
Encapsulates a pointer to a list element.
Definition: List.h:42
const Graph * m_pGraph
The original graph.
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.
bool splittable(node v) const
Returns true iff v is splittable.
Includes declaration of graph class.
edge originalEdge(edge e) const
Returns the original edge of e, or 0 if e has none (e.g., e belongs to a node split).
NodeSplit * nodeSplitOf(edge e) const
Returns the node split associated with e, or 0 if none (e.g., e belongs to an original edge)...
List< NodeSplit > m_nodeSplits
NodeSplit(ListIterator< NodeSplit > it)
Creates a node split and sets its iterator in the list of all node splits.
The namespace for all OGDF objects.
NodeSplit()
Creates an empty node split.
node source() const
Returns the first node on the node split&#39;s insertion path.
const List< edge > & chain(edge eOrig) const
Returns the insertion path of edge eOrig.
Declaration and implementation of ogdf::NodeSet.
int numberOfCCs() const
Returns the number of connected components in the original graph.
Combinatorial embeddings of planar graphs with modification functionality.
node copy(node vOrig) const
Returns the first copy node of vOrig.
Class for adjacency list elements.
Definition: Graph_d.h:79
Declaration and implementation of ogdf::FaceSet.