Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ExtractKuratowskis.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <ogdf/basic/Array.h>
36#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/SList.h>
38#include <ogdf/basic/basic.h>
40
41#include <iosfwd>
42
43namespace ogdf {
44class BoyerMyrvoldPlanar;
45
48public:
51
53 inline bool isK33() const { return subdivisionType != SubdivisionType::E5; }
54
56 inline bool isK5() const { return subdivisionType == SubdivisionType::E5; }
57
59 enum class SubdivisionType {
60 A = 0,
61 AB = 1,
62 AC = 2,
63 AD = 3,
64 AE1 = 4,
65 AE2 = 5,
66 AE3 = 6,
67 AE4 = 7,
68 B = 8,
69 C = 9,
70 D = 10,
71 E1 = 11,
72 E2 = 12,
73 E3 = 13,
74 E4 = 14,
75 E5 = 15
76 };
79
82
85};
86
87OGDF_EXPORT std::ostream& operator<<(std::ostream& os, const KuratowskiWrapper::SubdivisionType& obj);
88
90
96public:
99
102
104 void extract(const SListPure<KuratowskiStructure>& allKuratowskis,
106
110
112 enum class KuratowskiType {
113 none = 0,
114 K33 = 1,
115 K5 = 2
116 };
117
119
126 const SListPure<edge>& list);
127
129
137#if 0
138 const NodeArray<int>& m_dfi,
139#endif
140 EdgeArray<int>& edgenumber);
141
143 static bool isANewKuratowski(const Graph& g, 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, const SList<KuratowskiWrapper>& output);
153
154 // avoid automatic creation of assignment operator
157
158protected:
161
163 const Graph& m_g;
164
168 const bool m_avoidE2Minors;
169
171
176
179
182
185
187 inline void addExternalFacePath(SListPure<edge>& list, const SListPure<adjEntry>& externPath) {
189 for (itExtern = externPath.begin(); itExtern.valid(); ++itExtern) {
190 list.pushBack((*itExtern)->theEdge());
191 }
192 }
193
195
197 inline adjEntry adjToLowestNodeBelow(node high, int low);
198
200
202 inline void addDFSPath(SListPure<edge>& list, node bottom, node top);
204
206 inline void addDFSPathReverse(SListPure<edge>& list, node bottom, node top);
207
209 inline void truncateEdgelist(SListPure<edge>& list1, const SListPure<edge>& list2);
210
213#if 0
214 const WInfo& info,
215#endif
216 const SListPure<edge>& pathX, const node endnodeX, const SListPure<edge>& pathY,
217 const node endnodeY, const SListPure<edge>& pathW);
220 //NodeArray<int>& nodeflags,
221 //const int nodemarker,
222 const KuratowskiStructure& k, const WInfo& info, const SListPure<edge>& pathX,
223 const node endnodeX, const SListPure<edge>& pathY, const node endnodeY,
224 const SListPure<edge>& pathW);
227 const int nodemarker, const KuratowskiStructure& k, EdgeArray<int>& flags,
228 const WInfo& info, const SListPure<edge>& pathX, const node endnodeX,
229 const SListPure<edge>& pathY, const node endnodeY, const SListPure<edge>& pathW);
232 const WInfo& info, const SListPure<edge>& pathX, const node endnodeX,
233 const SListPure<edge>& pathY, const node endnodeY, const SListPure<edge>& pathW);
236 const WInfo& info, const SListPure<edge>& pathX, const node endnodeX,
237 const SListPure<edge>& pathY, const node endnodeY, const SListPure<edge>& pathW);
239 void extractMinorE(SList<KuratowskiWrapper>& output, bool firstXPath, bool firstPath,
240 bool firstWPath, bool firstWOnHighestXY, const KuratowskiStructure& k,
241 const WInfo& info, const SListPure<edge>& pathX, const node endnodeX,
242 const SListPure<edge>& pathY, const node endnodeY, const SListPure<edge>& pathW);
244 void extractMinorEBundles(SList<KuratowskiWrapper>& output, bool firstXPath, bool firstPath,
245 bool firstWPath, bool firstWOnHighestXY, NodeArray<int>& nodeflags,
246 const int nodemarker, const KuratowskiStructure& k, EdgeArray<int>& flags,
247 const WInfo& info, const SListPure<edge>& pathX, const node endnodeX,
248 const SListPure<edge>& pathY, const node endnodeY, const SListPure<edge>& pathW);
249
251 inline bool isMinorE1(int before, bool firstXPath, bool firstYPath) const {
252 return (before == -1 && firstXPath) || (before == 1 && firstYPath);
253 }
254
257#if 0
258 const node z,
259#endif
260 const node px, const node py, const KuratowskiStructure& k, const WInfo& info,
261 const SListPure<edge>& pathX, const node endnodeX, const SListPure<edge>& pathY,
262 const node endnodeY, const SListPure<edge>& pathW, const SListPure<edge>& pathZ,
263 const node endnodeZ);
265 inline bool checkMinorE2(bool firstWPath, bool firstWOnHighestXY) const {
266 return !m_avoidE2Minors && firstWPath && firstWOnHighestXY;
267 }
268
270 inline bool isMinorE2(const node endnodeX, const node endnodeY, const node endnodeZ) const {
271 return m_dfi[endnodeZ] > m_dfi[endnodeX] && m_dfi[endnodeZ] > m_dfi[endnodeY];
272 }
273
276#if 0
277 int before,
278 const node z,
279 const node px,
280 const node py,
281#endif
282 const KuratowskiStructure& k, const WInfo& info, const SListPure<edge>& pathX,
283 const node endnodeX, const SListPure<edge>& pathY, const node endnodeY,
284#if 0
285 const SListPure<edge>& pathW,
286#endif
287 const SListPure<edge>& pathZ
288#if 0
289 , const node endnodeZ
290#endif
291 );
293 inline bool isMinorE3(const node endnodeX, const node endnodeY, const node endnodeZ) const {
294 return endnodeX != endnodeY
295 && (m_dfi[endnodeX] > m_dfi[endnodeZ] || m_dfi[endnodeY] > m_dfi[endnodeZ]);
296 }
297
299 void extractMinorE3(SList<KuratowskiWrapper>& output, int before, const node z, const node px,
300 const node py, const KuratowskiStructure& k, const WInfo& info,
301 const SListPure<edge>& pathX, const node endnodeX, const SListPure<edge>& pathY,
302 const node endnodeY, const SListPure<edge>& pathW, const SListPure<edge>& pathZ,
303 const node endnodeZ);
304
306 inline bool isMinorE4(const node px, const node py, const KuratowskiStructure& k,
307 const WInfo& info) const {
308 return (px != k.stopX && !info.pxAboveStopX) || (py != k.stopY && !info.pyAboveStopY);
309 }
310
312 void extractMinorE4(SList<KuratowskiWrapper>& output, int before, const node z, const node px,
313 const node py, const KuratowskiStructure& k, const WInfo& info,
314 const SListPure<edge>& pathX, const node endnodeX, const SListPure<edge>& pathY,
315 const node endnodeY, const SListPure<edge>& pathW, const SListPure<edge>& pathZ,
316 const node endnodeZ);
317
319 inline bool isMinorE5(const node px, const node py, const KuratowskiStructure& k,
320 const node endnodeX, const node endnodeY, const node endnodeZ) const {
321 return px == k.stopX && py == k.stopY && k.V == k.RReal
322 && ((endnodeX == endnodeY && m_dfi[endnodeZ] <= m_dfi[endnodeX])
323 || (endnodeX == endnodeZ && m_dfi[endnodeY] <= m_dfi[endnodeX])
324 || (endnodeY == endnodeZ && m_dfi[endnodeX] <= m_dfi[endnodeY]));
325 }
326
329#if 0
330 int before,
331 const node z,
332 const node px,
333 const node py,
334#endif
335 const KuratowskiStructure& k, const WInfo& info, const SListPure<edge>& pathX,
336 const node endnodeX, const SListPure<edge>& pathY, const node endnodeY,
337 const SListPure<edge>& pathW, const SListPure<edge>& pathZ, const node endnodeZ);
338};
339
340}
Declaration and implementation of Array class and Array algorithms.
Declaration of the class FindKuratowskis.
Includes declaration of graph class.
Declaration of singly linked lists and iterators.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
This class implements the extended BoyerMyrvold planarity embedding algorithm.
Extracts multiple Kuratowski Subdivisions.
void extractMinorA(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype A and adds it to list output.
void extractMinorEBundles(SList< KuratowskiWrapper > &output, bool firstXPath, bool firstPath, bool firstWPath, bool firstWOnHighestXY, NodeArray< int > &nodeflags, const int nodemarker, const KuratowskiStructure &k, EdgeArray< int > &flags, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype E and adds it to list output (bundles)
int m_embeddingGrade
Some parameters, see BoyerMyrvold for further instructions.
void extractMinorE1(SList< KuratowskiWrapper > &output, int before, const node px, const node py, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW, const SListPure< edge > &pathZ, const node endnodeZ)
Extracts minorsubtype E1 and adds it to list output.
void addDFSPathReverse(SListPure< edge > &list, node bottom, node top)
Adds DFS-path from node top to node bottom to list.
bool isMinorE3(const node endnodeX, const node endnodeY, const node endnodeZ) const
Checks for minortype E3.
const Array< node > & m_nodeFromDFI
Returns appropriate node from given DFI.
void extract(const SListPure< KuratowskiStructure > &allKuratowskis, SList< KuratowskiWrapper > &output)
Extracts all Kuratowski Subdivisions and adds them to output (without bundles)
BoyerMyrvoldPlanar & BMP
Link to class BoyerMyrvoldPlanar.
void extractMinorBBundles(SList< KuratowskiWrapper > &output, NodeArray< int > &nodeflags, const int nodemarker, const KuratowskiStructure &k, EdgeArray< int > &flags, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype B and adds it to list output (with bundles)
bool isMinorE4(const node px, const node py, const KuratowskiStructure &k, const WInfo &info) const
Checks for minortype E4.
ExtractKuratowskis & operator=(const ExtractKuratowskis &)
Assignment operator is undefined!
KuratowskiType
Enumeration over Kuratowski Type none, K33, K5.
@ none
no kuratowski subdivision exists
@ K33
a K3,3 subdivision exists
static bool isANewKuratowski(const Graph &g, const SListPure< edge > &kuratowski, const SList< KuratowskiWrapper > &output)
Returns true, iff the Kuratowski is not already contained in output.
void extractMinorB(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype B and adds it to list output (no bundles)
adjEntry adjToLowestNodeBelow(node high, int low)
Returns adjEntry of the edge between node high and a special node.
void extractMinorE4(SList< KuratowskiWrapper > &output, int before, const node z, const node px, const node py, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW, const SListPure< edge > &pathZ, const node endnodeZ)
Extracts minorsubtype E4 and adds it to list output.
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)
void extractMinorD(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype D and adds it to list output.
static KuratowskiType whichKuratowski(const Graph &m_g, const NodeArray< int > &dfi, const SListPure< edge > &list)
Checks, if list forms a valid Kuratowski Subdivision and returns the type.
int m_nodeMarker
Value used as marker for visited nodes etc.
void extractBundles(const SListPure< KuratowskiStructure > &allKuratowskis, SList< KuratowskiWrapper > &output)
Extracts all Kuratowski Subdivisions and adds them to output (with bundles)
bool isMinorE1(int before, bool firstXPath, bool firstYPath) const
Checks for minortype E1.
ExtractKuratowskis(BoyerMyrvoldPlanar &bm)
Constructor.
bool checkMinorE2(bool firstWPath, bool firstWOnHighestXY) const
Checks for minortype E2 preconditions.
const NodeArray< adjEntry > & m_adjParent
The adjEntry which goes from DFS-parent to current vertex.
static KuratowskiType whichKuratowskiArray(const Graph &g, EdgeArray< int > &edgenumber)
Checks, if edges in Array edgenumber form a valid Kuratowski Subdivision and returns the type.
void extractMinorE2(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathZ)
Extracts minorsubtype E2 and adds it to list output.
const Graph & m_g
Input graph.
void addDFSPath(SListPure< edge > &list, node bottom, node top)
Adds DFS-path from node bottom to node top to list.
NodeArray< int > m_wasHere
Array maintaining visited bits on each node.
void extractMinorE5(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW, const SListPure< edge > &pathZ, const node endnodeZ)
Extracts minorsubtype E5 and adds it to list output.
const NodeArray< int > & m_dfi
The one and only DFI-NodeArray.
bool isMinorE2(const node endnodeX, const node endnodeY, const node endnodeZ) const
Checks for minortype E2.
static bool isANewKuratowski(const EdgeArray< int > &test, const SList< KuratowskiWrapper > &output)
Returns true, iff the Kuratowski is not already contained in output.
void truncateEdgelist(SListPure< edge > &list1, const SListPure< edge > &list2)
Separates list1 from edges already contained in list2.
void extractMinorE3(SList< KuratowskiWrapper > &output, int before, const node z, const node px, const node py, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW, const SListPure< edge > &pathZ, const node endnodeZ)
Extracts minorsubtype E3 and adds it to list output.
const bool m_avoidE2Minors
Some parameters, see BoyerMyrvold for further instructions.
void extractMinorE(SList< KuratowskiWrapper > &output, bool firstXPath, bool firstPath, bool firstWPath, bool firstWOnHighestXY, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype E and adds it to list output (no bundles)
void addExternalFacePath(SListPure< edge > &list, const SListPure< adjEntry > &externPath)
Adds external face edges to list.
void extractMinorC(SList< KuratowskiWrapper > &output, const KuratowskiStructure &k, const WInfo &info, const SListPure< edge > &pathX, const node endnodeX, const SListPure< edge > &pathY, const node endnodeY, const SListPure< edge > &pathW)
Extracts minortype C and adds it to list output.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
A Kuratowski Structure is a special graph structure containing severals subdivisions.
node stopX
First stopping node.
node stopY
Second stopping node.
node RReal
Real node of virtual node R.
node V
The current node to embed.
Wrapper-class for Kuratowski Subdivisions containing the minortype and edgelist.
node V
The node which was embedded while the Kuratowski Subdivision was found.
SubdivisionType
Possible minortypes of a Kuratowski Subdivision.
SubdivisionType subdivisionType
Minortype of the Kuratowski Subdivision.
bool isK33() const
Returns true, iff subdivision is a K3,3-minor.
bool isK5() const
Returns true, iff subdivision is a K5-minor.
SListPure< edge > edgeList
Contains the edges of the Kuratowski Subdivision.
Class for the representation of nodes.
Definition Graph_d.h:241
Singly linked lists (maintaining the length of the list).
Definition SList.h:845
Encapsulates a pointer to an ogdf::SList element.
Definition SList.h:104
bool valid() const
Returns true iff the iterator points to an element.
Definition SList.h:134
Singly linked lists.
Definition SList.h:191
iterator begin()
Returns an iterator to the first element of the list.
Definition SList.h:344
iterator pushBack(const E &x)
Adds element x at the end of the list.
Definition SList.h:481
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition Array.h:983
Saves information about a pertinent node w between two stopping vertices.