Tests if a graph can be drawn on a plane without any edge crossings More...
#include <GTL/planarity.h>
Inherits: algorithm
This class implements the Lempel-Even-Cederbaum planarity test using PQ-trees. In case the graph is planar a planar embedding is obtained, i.e. for each node in the graph an ordered adjacency list is calculated, such that there exists a planar drawing in which all adjacent edges around a node apply to this order.
If the graph is not planar Kuratowski's famous theorem states that it must contain a subgraph hoemeomorphic to either K5 (the complete graph with five nodes) or K3,3 (the complete bipartite graph with three nodes each side). In this case the nodes and edges of the tested graph that form either of these two are calculated.
In case the graph is planar and has N nodes the algorithm needs
O(N)
time for the test (including the planar embedding). In case
the graph isn't planar it needs at most O(E)
time if E is the
number of edges for both the test and the detection of K5 or K3,3.
[public]
Creates an object of the planarity test algorithm.
[public]
Checks whether planarity test can be applied to G
. This should
return always GTL_OK
. There aren't any restrictions on
G
, even multiple edges and selfloops are tolerated. Note:
Selfloops and multiple edges will not be added to the planar embedding.
planar_embedding::selfloops and planar_embedding::multiple_edges can
be used to get these.
G | arbitrary graph |
GTL_OK
if planarity test can be applied
or GTL_ERROR
if not.[public]
Runs planarity test on G
. This should return always
GTL_OK
. The return value only tracks errors that might
occur, it is definitly not the result of the test itself.
The result of the test is stored in a member variable and can be
accessed via planarity::is_planar .
G | arbitrary graph |
GTL_OK
if planarity test was sucessfully applied
or GTL_ERROR
if not.[public]
Resets algorithm object, such that it can be applied to another graph.
[public]
If p
is true a planar embedding will be calculated in
the next run.
p | true iff embedding should be calculated. |
[public]
Returns true if a planar embedding will be calculated in the next run.
[public]
If p
is true the obstructions to planarity will be calculated
in the next run. This implies the calculation of an embedding.
p | true iff obstructions to planarity should be calculated. |
[public]
Returns true if the obstructions to planarity will be calculated in the next run.
[public]
Determines the strategy used to test a graph which is not biconnected If this is enabled the graph will be made biconnected by adding some new edges. This is usually faster than testing the biconnected components one by one, which is done if this option is disabled. By default this is enabled.
Please note that this is not fully tested, i.e. at the moment this feature should be used only for the test without embedding or kuratowski graphs.
p | true iff graph should be made biconnected. |
[public]
Returns strategy for testing graphs, which are not biconnected.
[public]
Result of last test.
run
was planar.[public]
If graph in last run
was planar a planar embedding is
calculated during the reductions. This function gives access to it.
run
.[public]
Returns the edges of a subgraph homeomorphic to either K3,3 or K5 if
graph in last run
was not planar.
[public]
Returns the nodes of a subgraph homeomorphic to either K3,3 or K5 if
graph in last run
was not planar.
Kdoc |