Open
Graph Drawing
Framework

 v.2012.07
 

PlanRepExpansion.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2523 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7  ***************************************************************/
8 
45 #ifdef _MSC_VER
46 #pragma once
47 #endif
48 
49 #ifndef OGDF_PLAN_REP_EXPANSION_H
50 #define OGDF_PLAN_REP_EXPANSION_H
51 
52 
53 #include <ogdf/basic/Graph.h>
54 #include <ogdf/basic/tuples.h>
55 #include <ogdf/basic/SList.h>
56 
57 
58 namespace ogdf {
59 
60 
61 class OGDF_EXPORT CombinatorialEmbedding;
62 class OGDF_EXPORT FaceSetPure;
63 class OGDF_EXPORT NodeSetPure;
64 
65 
73 {
74 public:
75  struct Crossing {
76  Crossing() { m_adj = 0; }
77  Crossing(adjEntry adj) { m_adj = adj; }
78 
82 
83  friend ostream &operator<<(ostream &os, const Crossing &c) {
84  os << "(" << c.m_adj << ")";
85  return os;
86  }
87  };
88 
89 
96  class NodeSplit
97  {
98  public:
102  NodeSplit() { }
103 
107  NodeSplit(ListIterator<NodeSplit> it) : m_nsIterator(it) { }
108 
112  node source() const { return m_path.front()->source(); }
113 
117  node target() const { return m_path.back ()->target(); }
118 
121  };
122 
125 
126 
132  PlanRepExpansion(const Graph& G);
133 
141  PlanRepExpansion(const Graph& G, const List<node> &splittableNodes);
142 
144 
145 
150 
152  const Graph &original() const { return *m_pGraph; }
153 
155  node original(node v) const { return m_vOrig[v]; }
156 
158  const List<node> &expansion(node vOrig) const { return m_vCopy[vOrig]; }
159 
161  node copy(node vOrig) const { return m_vCopy[vOrig].front(); }
162 
164  edge originalEdge(edge e) const { return m_eOrig[e]; }
165 
167  const List<edge> &chain(edge eOrig) const { return m_eCopy[eOrig]; }
168 
170  edge copy(edge eOrig) const { return m_eCopy[eOrig].front(); }
171 
173  bool splittable(node v) const { return m_splittable[v]; }
174 
176  bool splittableOrig(node vOrig) const { return m_splittableOrig[vOrig]; }
177 
179  NodeSplit *nodeSplitOf(edge e) const { return m_eNodeSplit[e]; }
180 
182  int numberOfNodeSplits() const { return m_nodeSplits.size(); }
183  int numberOfSplittedNodes() const;
184 
186  List<NodeSplit> &nodeSplits() { return m_nodeSplits; }
187 
197  List<edge> &setOrigs(edge e, edge &eOrig, nodeSplit &ns);
198 
199  ListConstIterator<edge> position(edge e) const { return m_eIterator[e]; }
200 
201  bool isPseudoCrossing(node v) const;
202 
204  int computeNumberOfCrossings() const;
205 
207 
211 
212 
216  int numberOfCCs() const {
217  return m_nodesInCC.size();
218  }
219 
223  int currentCC() const {
224  return m_currentCC;
225  }
226 
232  const List<node> &nodesInCC(int i) const {
233  return m_nodesInCC[i];
234  }
235 
239  const List<node> &nodesInCC() const {
240  return m_nodesInCC[m_currentCC];
241  }
242 
251  void initCC(int i);
252 
253 
255 
259 
260  edge split(edge e);
261 
262  void unsplit(edge eIn, edge eOut);
263 
265  void delCopy(edge e);
266 
268  bool embed();
269 
270  void insertEdgePath(
271  edge eOrig,
272  nodeSplit ns,
273  node vStart,
274  node vEnd,
275  List<Crossing> &eip,
276  edge eSrc,
277  edge eTgt);
278 
291  void insertEdgePathEmbedded(
292  edge eOrig,
293  nodeSplit ns,
294  CombinatorialEmbedding &E,
295  const List<Tuple2<adjEntry,adjEntry> > &crossedEdges);
296 
310  void removeEdgePathEmbedded(
311  CombinatorialEmbedding &E,
312  edge eOrig,
313  nodeSplit ns,
314  FaceSetPure &newFaces,
315  NodeSetPure &mergedNodes,
316  node &oldSrc,
317  node &oldTgt);
318 
328  void removeEdgePath(
329  edge eOrig,
330  nodeSplit ns,
331  node &oldSrc,
332  node &oldTgt);
333 
342  void contractSplit(nodeSplit ns, CombinatorialEmbedding &E);
343 
351  void contractSplit(nodeSplit ns);
352 
363  edge unsplitExpandNode(
364  node u,
365  edge eContract,
366  edge eExpand,
367  CombinatorialEmbedding &E);
368 
378  edge unsplitExpandNode(
379  node u,
380  edge eContract,
381  edge eExpand);
382 
394  edge enlargeSplit(node v, edge e, CombinatorialEmbedding &E);
395 
406  edge enlargeSplit(node v, edge e);
407 
417  edge splitNodeSplit(edge e, CombinatorialEmbedding &E);
418 
427  edge splitNodeSplit(edge e);
428 
437  void removeSelfLoop(edge e, CombinatorialEmbedding &E);
438 
439  void removeSelfLoop(edge e);
440 
452  PlanRepExpansion::nodeSplit convertDummy(
453  node u,
454  node vOrig,
456 
457  edge separateDummy(
458  adjEntry adj_1,
459  adjEntry adj_2,
460  node vStraight,
461  bool isSrc);
462 
463  void resolvePseudoCrossing(node v);
464 
466 
470 
474  bool consistencyCheck() const;
475 
477 
478 private:
479  void doInit(const Graph &G, const List<node> &splittableNodes);
480  void prepareNodeSplit(
481  const SList<adjEntry> &partitionLeft,
482  adjEntry &adjLeft,
483  adjEntry &adjRight);
484 
485  const Graph *m_pGraph;
492 
497 
499  int m_numCC;
500 
503 };
504 
505 
506 } // end namespace ogdf
507 
508 
509 #endif