Wrapper class used for preprocessing and valid invocation of the planarity test. More...
#include <ogdf/planarity/BoyerMyrvold.h>
Protected Member Functions | |
void | clear () |
Deletes BoyerMyrvoldPlanar on heap. | |
Protected Attributes | |
int | nOfStructures |
The number of extracted Structures for statistical purposes. | |
BoyerMyrvoldPlanar * | pBMP |
Class BoyerMyrvoldPlanar on heap. | |
Wrapper class used for preprocessing and valid invocation of the planarity test.
This class is part of the extended Boyer-Myrvold planarity embedding algorithm to simplify invocation besides adding standard parameters (see classes in BoyerMyrvoldInit.h and BoyerMyrvoldPlanar.h). In addition the linear-time Boyer-Myrvold embedding algorithm was extended to extract multiple Kuratowski Subdivisions, whose number can be limited as desired (see classes in FindKuratowskis.h and ExtractKuratowskis.h). Furthermore all extracted subdivisions are unique.
Input graph:
There are no restrictions on the input graph G (except that it has to be finite, but if you do not have infinite RAM, that should do it :) ). In particular, G hasn't to be biconnected nor connected. Self-loops and multigraphs are possible, too.
Note: But if you want to use the extraction of Kuratowski Subdivisions, G has to be simple!
How to use it:
There exist two main functions, consisting of the planarity test itself and the planar embedding algorithm, which embeds the graph on the plane if possible. Each one has a fast but destructive variant, designed to be used on graphs that may be modified and a slower variant, which is for graphs that must not be altered. Embeddings on the plane are given by a (genus 0) cyclic ordering of adjacency lists in the graph. Functions for constant graphs are available, too, if that makes sense for the function.
Examples:
BoyerMyrvold::isPlanarDestructive(G), BoyerMyrvold::isPlanar(G):
Tests graph G for planarity with the Boyer-Myrvold planarity test.
BoyerMyrvold::planarEmbedDestructive(G), BoyerMyrvold::planarEmbed(G), BoyerMyrvold::planarEmbed(G,H):
Tests graph G for planarity and returns a planar embedding in G, if G is planar. If G is a constant graph, the embedding is given in the GraphCopySimple H, so that both, the constant input graph and the resulting planar embedding are available.
BoyerMyrvold::planarEmbedDestructive(G,output,i), BoyerMyrvold::planarEmbed(G,output,i):
Tests graph G for planarity and returns a planar embedding, if G is planar. Otherwise up to i Kuratowski subdivisions are returned to the list output. Use i = -1 for extraction of all subdivisions.
BoyerMyrvold::planarEmbedDestructive(G,output,i), BoyerMyrvold::planarEmbed(G,output,i):
Tests graph G for planarity and returns a planar embedding, if G is planar. Otherwise up to i Kuratowski subdivisions are returned to the list output. Use i = -1 for extraction of all subdivisions. The extraction algorithm doesn't use sets of bundles instead of subdivisions paths, so this is designed for a fast computation while extracting some, but not a huge amount of Kuratowski Subdivisions.
BoyerMyrvold::planarEmbedDestructive(G,output,i,true), BoyerMyrvold::planarEmbed(G,output,i,true):
This is the same as above, but now bundles are used to compute much more subdivisions. Naturally the computation is slower than the function above, especially on large graphs.
Complete list of parameters for embedding functions:
e.g. planarEmbedDestructive(
i:
true
, a completely random DFS-Tree (the list of nodes and the adjacency-lists for each node are permuted at random) is created each time the planarity test is called. This is important for extracting huge amounts of Kuratowski subdivisions of one single Graph, since randomizing the DFSTree yields to new unknown subdivisions. Note that computation time growths up to 20 percent longer.true
, otherwise false
.)
To experience the computation time difference to the PQTree-Planarity test please switch to release-mode, since a lot of slow testroutines and assertions were implemented in debug-mode. Also note the ability to transform KuratowskiWrapperLists to Lists of KuratowskiSubdivision through calling the function transform. Within this transformation is a switch to filter all similar or not similar Kuratowski Subdivisions.
Definition at line 138 of file BoyerMyrvold.h.
|
inline |
Constructor.
Definition at line 154 of file BoyerMyrvold.h.
|
inline |
Destructor.
Definition at line 160 of file BoyerMyrvold.h.
|
inlineprotected |
Deletes BoyerMyrvoldPlanar on heap.
Definition at line 144 of file BoyerMyrvold.h.
Returns true, iff a copy of the constant graph g
is planar.
Use this slower routine, if your graph must not be alterated.
Implements ogdf::PlanarityModule.
Returns true, iff g
is planar.
This is the routine, which avoids the overhead of copying the input graph. It is therefore not suitable, if your graph must not be alterated!
Implements ogdf::PlanarityModule.
|
inline |
The number of extracted Structures for statistical purposes.
Definition at line 163 of file BoyerMyrvold.h.
Returns true, if G is planar, false otherwise. If true, G contains a planar embedding.
Implements ogdf::PlanarityModule.
Definition at line 177 of file BoyerMyrvold.h.
|
inline |
Returns an embedding, if g
is planar and Kuratowski Subdivisions otherwise.
If g
is planar, the adjLists of g
specify a planar embedding. The function copies the graph before computation. Use this function, if g
must not be changed in the non-planar case.
g | is the input graph. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
Definition at line 260 of file BoyerMyrvold.h.
bool ogdf::BoyerMyrvold::planarEmbed | ( | Graph & | g, |
SList< KuratowskiWrapper > & | output, | ||
int | embeddingGrade, | ||
bool | bundles = false , |
||
bool | limitStructures = false , |
||
bool | randomDFSTree = false , |
||
bool | avoidE2Minors = true |
||
) |
Returns an embedding, if g
is planar and Kuratowski Subdivisions otherwise.
If g
is planar, the adjLists of g
specify a planar embedding. The function copies the graph before computation. Use this function, if g
must not be changed in the non-planar case.
g | is the input graph. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
|
inline |
Returns an embedding, if graph copy h
is planar and Kuratowski Subdivisions otherwise.
If h
is planar, the adjLists of h
specify a planar embedding. The function copies the graph before computation. Use this function, if g
must not be changed.
h | is the input graph copy. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
Definition at line 285 of file BoyerMyrvold.h.
bool ogdf::BoyerMyrvold::planarEmbed | ( | GraphCopySimple & | h, |
SList< KuratowskiWrapper > & | output, | ||
int | embeddingGrade, | ||
bool | bundles = false , |
||
bool | limitStructures = false , |
||
bool | randomDFSTree = false , |
||
bool | avoidE2Minors = true |
||
) |
Returns an embedding, if graph copy h
is planar and Kuratowski Subdivisions otherwise.
If h
is planar, the adjLists of h
specify a planar embedding. The function copies the graph before computation. Use this function, if g
must not be changed.
h | is the input graph copy. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
|
inline |
Returns an embedding, if g
is planar and Kuratowski Subdivisions otherwise.
If g
is planar, the adjLists of g
specify a planar embedding. Use this function, if g
may be changed.
g | is the input graph. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
Definition at line 234 of file BoyerMyrvold.h.
bool ogdf::BoyerMyrvold::planarEmbedDestructive | ( | Graph & | g, |
SList< KuratowskiWrapper > & | output, | ||
int | embeddingGrade, | ||
bool | bundles = false , |
||
bool | limitStructures = false , |
||
bool | randomDFSTree = false , |
||
bool | avoidE2Minors = true |
||
) |
Returns an embedding, if g
is planar and Kuratowski Subdivisions otherwise.
If g
is planar, the adjLists of g
specify a planar embedding. Use this function, if g
may be changed.
g | is the input graph. |
output | contains a number of Kuratowski Subdivisions depending on the other parameters |
embeddingGrade | is a flag bounding the number of extracted subdivisions |
bundles | extracts much more subdivisions, if set |
limitStructures | limits the number of Kuratowski Structures to embeddingGrade , if set |
randomDFSTree | randomizes Kuratowski extraction through randomizing the DFSTree, if set |
avoidE2Minors | avoids all E2-Minors and ensures unique subdivisions, if set |
Constructs a planar embedding of G. G
has to be planar!
Returns true if the embedding was successful. Returns false, if the given graph was non-planar (and leaves the graph in an at least partially deleted state)
This routine is slightly faster than planarEmbed, but requires G
to be planar. If G
is not planar, the graph will be destroyed while trying to embed it!
Implements ogdf::PlanarityModule.
Definition at line 191 of file BoyerMyrvold.h.
void ogdf::BoyerMyrvold::transform | ( | const KuratowskiWrapper & | source, |
KuratowskiSubdivision & | target, | ||
NodeArray< int > & | count, | ||
EdgeArray< int > & | countEdge | ||
) |
Transforms KuratowskiWrapper in KuratowskiSubdivision.
void ogdf::BoyerMyrvold::transform | ( | const SList< KuratowskiWrapper > & | sourceList, |
SList< KuratowskiSubdivision > & | targetList, | ||
const Graph & | g, | ||
const bool | onlyDifferent = false |
||
) |
Transforms KuratowskiWrapper-List in KuratowskiSubdivision-List with respect to sieving constraints.
This method is called if BoyerMyrvold::planarEmbed was called with the Graph g previously.
|
inline |
Transforms KuratowskiWrapper-List in KuratowskiSubdivision-List with respect to sieving constraints.
This method is called if BoyerMyrvold::planarEmbed was called with the GraphCopySimple h previously.
Definition at line 212 of file BoyerMyrvold.h.
|
protected |
The number of extracted Structures for statistical purposes.
Definition at line 150 of file BoyerMyrvold.h.
|
protected |
Class BoyerMyrvoldPlanar on heap.
Definition at line 141 of file BoyerMyrvold.h.