Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 
39 
40 namespace ogdf {
41 
42 
43 class OGDF_EXPORT CombinatorialEmbedding;
44 class OGDF_EXPORT FaceSetPure;
45 class OGDF_EXPORT NodeSetPure;
46 
47 
57 {
58 public:
59  struct Crossing {
60  Crossing() { m_adj = nullptr; }
61  explicit Crossing(adjEntry adj) { m_adj = adj; }
62 
66 
67  friend ostream &operator<<(ostream &os, const Crossing &c) {
68  os << "(" << c.m_adj << ")";
69  return os;
70  }
71  };
72 
73 
80  class NodeSplit
81  {
82  public:
86  NodeSplit() { }
87 
91  explicit NodeSplit(ListIterator<NodeSplit> it) : m_nsIterator(it) { }
92 
96  node source() const { return m_path.front()->source(); }
97 
101  node target() const { return m_path.back ()->target(); }
102 
105  };
106 
109 
110 
116  PlanRepExpansion(const Graph& G);
117 
125  PlanRepExpansion(const Graph& G, const List<node> &splittableNodes);
126 
128 
129 
134 
136  const Graph &original() const { return *m_pGraph; }
137 
139  node original(node v) const { return m_vOrig[v]; }
140 
142  const List<node> &expansion(node vOrig) const { return m_vCopy[vOrig]; }
143 
145  node copy(node vOrig) const { return m_vCopy[vOrig].front(); }
146 
148  edge originalEdge(edge e) const { return m_eOrig[e]; }
149 
151  const List<edge> &chain(edge eOrig) const { return m_eCopy[eOrig]; }
152 
154  edge copy(edge eOrig) const { return m_eCopy[eOrig].front(); }
155 
157  bool splittable(node v) const { return m_splittable[v]; }
158 
160  bool splittableOrig(node vOrig) const { return m_splittableOrig[vOrig]; }
161 
163  NodeSplit *nodeSplitOf(edge e) const { return m_eNodeSplit[e]; }
164 
166  int numberOfNodeSplits() const { return m_nodeSplits.size(); }
167  int numberOfSplittedNodes() const;
168 
170  List<NodeSplit> &nodeSplits() { return m_nodeSplits; }
171 
181  List<edge> &setOrigs(edge e, edge &eOrig, nodeSplit &ns);
182 
183  ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
184 
185  bool isPseudoCrossing(node v) const;
186 
188  int computeNumberOfCrossings() const;
189 
191 
195 
196 
200  int numberOfCCs() const {
201  return m_nodesInCC.size();
202  }
203 
207  int currentCC() const {
208  return m_currentCC;
209  }
210 
216  const List<node> &nodesInCC(int i) const {
217  return m_nodesInCC[i];
218  }
219 
223  const List<node> &nodesInCC() const {
224  return m_nodesInCC[m_currentCC];
225  }
226 
235  void initCC(int i);
236 
237 
239 
243 
244  edge split(edge e) override;
245 
246  void unsplit(edge eIn, edge eOut) override;
247 
249  virtual void delEdge(edge e) override;
250 
252  bool embed();
253 
254  void insertEdgePath(
255  edge eOrig,
256  nodeSplit ns,
257  node vStart,
258  node vEnd,
259  List<Crossing> &eip,
260  edge eSrc,
261  edge eTgt);
262 
275  void insertEdgePathEmbedded(
276  edge eOrig,
277  nodeSplit ns,
279  const List<Tuple2<adjEntry,adjEntry> > &crossedEdges);
280 
294  void removeEdgePathEmbedded(
296  edge eOrig,
297  nodeSplit ns,
298  FaceSetPure &newFaces,
299  NodeSetPure &mergedNodes,
300  node &oldSrc,
301  node &oldTgt);
302 
312  void removeEdgePath(
313  edge eOrig,
314  nodeSplit ns,
315  node &oldSrc,
316  node &oldTgt);
317 
326  void contractSplit(nodeSplit ns, CombinatorialEmbedding &E);
327 
335  void contractSplit(nodeSplit ns);
336 
347  edge unsplitExpandNode(
348  node u,
349  edge eContract,
350  edge eExpand,
352 
362  edge unsplitExpandNode(
363  node u,
364  edge eContract,
365  edge eExpand);
366 
378  edge enlargeSplit(node v, edge e, CombinatorialEmbedding &E);
379 
390  edge enlargeSplit(node v, edge e);
391 
401  edge splitNodeSplit(edge e, CombinatorialEmbedding &E);
402 
411  edge splitNodeSplit(edge e);
412 
421  void removeSelfLoop(edge e, CombinatorialEmbedding &E);
422 
423  void removeSelfLoop(edge e);
424 
436  PlanRepExpansion::nodeSplit convertDummy(
437  node u,
438  node vOrig,
440 
441  edge separateDummy(
442  adjEntry adj_1,
443  adjEntry adj_2,
444  node vStraight,
445  bool isSrc);
446 
447  void resolvePseudoCrossing(node v);
448 
450 
454 
458  bool consistencyCheck() const;
459 
461 
462 private:
463  void doInit(const Graph &G, const List<node> &splittableNodes);
464  void prepareNodeSplit(
465  const SList<adjEntry> &partitionLeft,
466  adjEntry &adjLeft,
467  adjEntry &adjRight);
468 
469  const Graph *m_pGraph;
476 
481 
483  int m_numCC;
484 
487 };
488 
489 
490 } // end namespace ogdf
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:56
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:472
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.
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
Node sets.
Definition: NodeSet.h:136
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:777
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:423
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:291
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:167
const List< node > & expansion(node vOrig) const
Returns the list of copy nodes of vOrig.
NodeArray< bool > m_splittable
Encapsulates a pointer to a list element.
Definition: List.h:41
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.
Face sets.
Definition: FaceSet.h:138
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.
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:78
friend ostream & operator<<(ostream &os, const Crossing &c)