Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ExtractKuratowskis.h
Go to the documentation of this file.
1 
33 #pragma once
34 
37 #include <ogdf/basic/Stack.h>
38 
39 namespace ogdf {
40 
43 public:
46 
48  inline bool isK33() const { return subdivisionType != SubdivisionType::E5; }
50  inline bool isK5() const { return subdivisionType == SubdivisionType::E5; }
51 
53  enum class SubdivisionType {
54  A=0,
55  AB=1,
56  AC=2,
57  AD=3,
58  AE1=4,
59  AE2=5,
60  AE3=6,
61  AE4=7,
62  B=8,
63  C=9,
64  D=10,
65  E1=11,
66  E2=12,
67  E3=13,
68  E4=14,
69  E5=15
70  };
73 
76 
79 };
80 
81 OGDF_EXPORT ostream &operator<<(ostream &os, const KuratowskiWrapper::SubdivisionType &obj);
82 
84 
90 public:
95 
97  void extract(
98  const SListPure<KuratowskiStructure>& allKuratowskis,
99  SList<KuratowskiWrapper>& output);
100 
102  void extractBundles(
103  const SListPure<KuratowskiStructure>& allKuratowskis,
104  SList<KuratowskiWrapper>& output);
105 
107  enum class KuratowskiType {
108  none = 0,
109  K33 = 1,
110  K5 = 2
111  };
112 
114 
120  static KuratowskiType whichKuratowski(
121  const Graph& m_g,
122  const NodeArray<int>& dfi,
123  const SListPure<edge>& list);
124 
126 
133  static KuratowskiType whichKuratowskiArray(
134  const Graph& g,
135 #if 0
136  const NodeArray<int>& m_dfi,
137 #endif
138  EdgeArray<int>& edgenumber);
139 
141  static bool isANewKuratowski(
142  const Graph& g,
143  const SListPure<edge>& kuratowski,
144  const SList<KuratowskiWrapper>& output);
146 
148  static bool isANewKuratowski(
149 #if 0
150  const Graph& g,
151 #endif
152  const EdgeArray<int>& test,
153  const SList<KuratowskiWrapper>& output);
154 
155  // avoid automatic creation of assignment operator
157  ExtractKuratowskis &operator=(const ExtractKuratowskis &);
158 
159 protected:
162 
164  const Graph& m_g;
165 
169  const bool m_avoidE2Minors;
170 
172 
177 
180 
183 
186 
188  inline void addExternalFacePath(
189  SListPure<edge>& list,
190  const SListPure<adjEntry>& externPath) {
192  for (itExtern = externPath.begin(); itExtern.valid(); ++itExtern) {
193  list.pushBack((*itExtern)->theEdge());
194  }
195  }
196 
198 
200  inline adjEntry adjToLowestNodeBelow(node high, int low);
201 
203 
205  inline void addDFSPath(SListPure<edge>& list, node bottom, node top);
207 
209  inline void addDFSPathReverse(SListPure<edge>& list, node bottom, node top);
210 
212  inline void truncateEdgelist(SListPure<edge>& list1, const SListPure<edge>& list2);
213 
215  void extractMinorA(
216  SList<KuratowskiWrapper>& output,
217  const KuratowskiStructure& k,
218 #if 0
219  const WInfo& info,
220 #endif
221  const SListPure<edge>& pathX,
222  const node endnodeX,
223  const SListPure<edge>& pathY,
224  const node endnodeY,
225  const SListPure<edge>& pathW);
227  void extractMinorB(
228  SList<KuratowskiWrapper>& output,
229  //NodeArray<int>& nodeflags,
230  //const int nodemarker,
231  const KuratowskiStructure& k,
232  const WInfo& info,
233  const SListPure<edge>& pathX,
234  const node endnodeX,
235  const SListPure<edge>& pathY,
236  const node endnodeY,
237  const SListPure<edge>& pathW);
239  void extractMinorBBundles(
240  SList<KuratowskiWrapper>& output,
241  NodeArray<int>& nodeflags,
242  const int nodemarker,
243  const KuratowskiStructure& k,
244  EdgeArray<int>& flags,
245  const WInfo& info,
246  const SListPure<edge>& pathX,
247  const node endnodeX,
248  const SListPure<edge>& pathY,
249  const node endnodeY,
250  const SListPure<edge>& pathW);
252  void extractMinorC(
253  SList<KuratowskiWrapper>& output,
254  const KuratowskiStructure& k,
255  const WInfo& info,
256  const SListPure<edge>& pathX,
257  const node endnodeX,
258  const SListPure<edge>& pathY,
259  const node endnodeY,
260  const SListPure<edge>& pathW);
262  void extractMinorD(
263  SList<KuratowskiWrapper>& output,
264  const KuratowskiStructure& k,
265  const WInfo& info,
266  const SListPure<edge>& pathX,
267  const node endnodeX,
268  const SListPure<edge>& pathY,
269  const node endnodeY,
270  const SListPure<edge>& pathW);
272  void extractMinorE(
273  SList<KuratowskiWrapper>& output,
274  bool firstXPath,
275  bool firstPath,
276  bool firstWPath,
277  bool firstWOnHighestXY,
278  const KuratowskiStructure& k,
279  const WInfo& info,
280  const SListPure<edge>& pathX,
281  const node endnodeX,
282  const SListPure<edge>& pathY,
283  const node endnodeY,
284  const SListPure<edge>& pathW);
286  void extractMinorEBundles(
287  SList<KuratowskiWrapper>& output,
288  bool firstXPath,
289  bool firstPath,
290  bool firstWPath,
291  bool firstWOnHighestXY,
292  NodeArray<int>& nodeflags,
293  const int nodemarker,
294  const KuratowskiStructure& k,
295  EdgeArray<int>& flags,
296  const WInfo& info,
297  const SListPure<edge>& pathX,
298  const node endnodeX,
299  const SListPure<edge>& pathY,
300  const node endnodeY,
301  const SListPure<edge>& pathW);
303  inline bool isMinorE1(
304  int before,
305  bool firstXPath,
306  bool firstYPath) const
307  {
308  return (before == -1 && firstXPath)
309  || (before == 1 && firstYPath);
310  }
312  void extractMinorE1(
313  SList<KuratowskiWrapper>& output,
314  int before,
315 #if 0
316  const node z,
317 #endif
318  const node px,
319  const node py,
320  const KuratowskiStructure& k,
321  const WInfo& info,
322  const SListPure<edge>& pathX,
323  const node endnodeX,
324  const SListPure<edge>& pathY,
325  const node endnodeY,
326  const SListPure<edge>& pathW,
327  const SListPure<edge>& pathZ,
328  const node endnodeZ);
330  inline bool checkMinorE2(
331  bool firstWPath,
332  bool firstWOnHighestXY) const
333  {
334  return !m_avoidE2Minors
335  && firstWPath
336  && firstWOnHighestXY;
337  }
339  inline bool isMinorE2(
340  const node endnodeX,
341  const node endnodeY,
342  const node endnodeZ) const
343  {
344  return m_dfi[endnodeZ] > m_dfi[endnodeX]
345  && m_dfi[endnodeZ] > m_dfi[endnodeY];
346  }
348  void extractMinorE2(
349  SList<KuratowskiWrapper>& output,
350 #if 0
351  int before,
352  const node z,
353  const node px,
354  const node py,
355 #endif
356  const KuratowskiStructure& k,
357  const WInfo& info,
358  const SListPure<edge>& pathX,
359  const node endnodeX,
360  const SListPure<edge>& pathY,
361  const node endnodeY,
362 #if 0
363  const SListPure<edge>& pathW,
364 #endif
365  const SListPure<edge>& pathZ
366 #if 0
367  , const node endnodeZ
368 #endif
369  );
371  inline bool isMinorE3(
372  const node endnodeX,
373  const node endnodeY,
374  const node endnodeZ) const
375  {
376  return endnodeX != endnodeY
377  && (m_dfi[endnodeX] > m_dfi[endnodeZ]
378  || m_dfi[endnodeY] > m_dfi[endnodeZ]);
379  }
381  void extractMinorE3(
382  SList<KuratowskiWrapper>& output,
383  int before,
384  const node z,
385  const node px,
386  const node py,
387  const KuratowskiStructure& k,
388  const WInfo& info,
389  const SListPure<edge>& pathX,
390  const node endnodeX,
391  const SListPure<edge>& pathY,
392  const node endnodeY,
393  const SListPure<edge>& pathW,
394  const SListPure<edge>& pathZ,
395  const node endnodeZ);
397  inline bool isMinorE4(
398  const node px,
399  const node py,
400  const KuratowskiStructure& k,
401  const WInfo& info) const
402  {
403  return (px != k.stopX && !info.pxAboveStopX)
404  || (py != k.stopY && !info.pyAboveStopY);
405  }
407  void extractMinorE4(
408  SList<KuratowskiWrapper>& output,
409  int before,
410  const node z,
411  const node px,
412  const node py,
413  const KuratowskiStructure& k,
414  const WInfo& info,
415  const SListPure<edge>& pathX,
416  const node endnodeX,
417  const SListPure<edge>& pathY,
418  const node endnodeY,
419  const SListPure<edge>& pathW,
420  const SListPure<edge>& pathZ,
421  const node endnodeZ);
423  inline bool isMinorE5(
424  const node px,
425  const node py,
426  const KuratowskiStructure& k,
427  const node endnodeX,
428  const node endnodeY,
429  const node endnodeZ) const
430  {
431  return px == k.stopX
432  && py == k.stopY
433  && k.V == k.RReal
434  && ((endnodeX == endnodeY
435  && m_dfi[endnodeZ] <= m_dfi[endnodeX])
436  || (endnodeX == endnodeZ
437  && m_dfi[endnodeY] <= m_dfi[endnodeX])
438  || (endnodeY == endnodeZ
439  && m_dfi[endnodeX] <= m_dfi[endnodeY]));
440  }
442  void extractMinorE5(
443  SList<KuratowskiWrapper>& output,
444 #if 0
445  int before,
446  const node z,
447  const node px,
448  const node py,
449 #endif
450  const KuratowskiStructure& k,
451  const WInfo& info,
452  const SListPure<edge>& pathX,
453  const node endnodeX,
454  const SListPure<edge>& pathY,
455  const node endnodeY,
456  const SListPure<edge>& pathW,
457  const SListPure<edge>& pathZ,
458  const node endnodeZ);
459 };
460 
461 }
KuratowskiType
Enumeration over Kuratowski Type none, K33, K5.
NodeArray< int > m_wasHere
Array maintaining visited bits on each node.
Extracts multiple Kuratowski Subdivisions.
SubdivisionType subdivisionType
Minortype of the Kuratowski Subdivision.
bool valid() const
Returns true iff the iterator points to an element.
Definition: SList.h:113
bool isK33() const
Returns true, iff subdivision is a K3,3-minor.
const NodeArray< int > & m_dfi
The one and only DFI-NodeArray.
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
const NodeArray< adjEntry > & m_adjParent
The adjEntry which goes from DFS-parent to current vertex.
KuratowskiWrapper()
Constructor.
Singly linked lists.
Definition: SList.h:38
node V
The current node to embed.
A Kuratowski Structure is a special graph structure containing severals subdivisions.
void addExternalFacePath(SListPure< edge > &list, const SListPure< adjEntry > &externPath)
Adds external face edges to list.
Declaration of the class FindKuratowskis.
Encapsulates a pointer to an ogdf::SList element.
Definition: SList.h:40
int m_nodeMarker
Value used as marker for visited nodes etc.
Singly linked lists (maintaining the length of the list).
Definition: SList.h:777
bool isMinorE4(const node px, const node py, const KuratowskiStructure &k, const WInfo &info) const
Checks for minortype E4.
ostream & operator<<(ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:764
node stopX
First stopping node.
iterator begin()
Returns an iterator to the first element of the list.
Definition: SList.h:316
Saves information about a pertinent node w between two stopping vertices.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Definition: SList.h:455
node stopY
Second stopping node.
SubdivisionType
Possible minortypes of a Kuratowski Subdivision.
node RReal
Real node of virtual node R.
node V
The node which was embedded while the Kuratowski Subdivision was found.
int m_embeddingGrade
Some parameters, see BoyerMyrvold for further instructions.
bool isMinorE3(const node endnodeX, const node endnodeY, const node endnodeZ) const
Checks for minortype E3.
Class for the representation of nodes.
Definition: Graph_d.h:167
const bool m_avoidE2Minors
Some parameters, see BoyerMyrvold for further instructions.
bool isMinorE5(const node px, const node py, const KuratowskiStructure &k, const node endnodeX, const node endnodeY, const node endnodeZ) const
Checks for minortype E5 (K5)
This class implements the extended BoyerMyrvold planarity embedding algorithm.
const Array< node > & m_nodeFromDFI
Returns appropriate node from given DFI.
bool isMinorE2(const node endnodeX, const node endnodeY, const node endnodeZ) const
Checks for minortype E2.
Declaration of the class BoyerMyrvoldPlanar.
const Graph & m_g
Input graph.
bool checkMinorE2(bool firstWPath, bool firstWOnHighestXY) const
Checks for minortype E2 preconditions.
The namespace for all OGDF objects.
bool isMinorE1(int before, bool firstXPath, bool firstYPath) const
Checks for minortype E1.
bool isK5() const
Returns true, iff subdivision is a K5-minor.
BoyerMyrvoldPlanar & BMP
Link to class BoyerMyrvoldPlanar.
Wrapper-class for Kuratowski Subdivisions containing the minortype and edgelist.
Class for adjacency list elements.
Definition: Graph_d.h:78
SListPure< edge > edgeList
Contains the edges of the Kuratowski Subdivision.
Declaration and implementation of list-based stacks (StackPure<E> and Stack<E>).