planarity Class Reference

[Index] [Hierarchy] [Headers]


Tests if a graph can be drawn on a plane without any edge crossings More...

#include <GTL/planarity.h>

Inherits: algorithm

Public Members


Detailed Description

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.


planarity() [public]

Creates an object of the planarity test algorithm.

See Also:
algorithm

int check(graph& G) [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.

Parameters:
G arbitrary graph
Returns:
GTL_OK if planarity test can be applied or GTL_ERROR if not.
See Also:
algorithm::check

int run(graph& G) [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 .

Parameters:
G arbitrary graph
Returns:
GTL_OK if planarity test was sucessfully applied or GTL_ERROR if not.
See Also:
algorithm::run

void reset() [public]

Resets algorithm object, such that it can be applied to another graph.

See Also:
algorithm::reset

void calc_embedding(bool p) [public]

If p is true a planar embedding will be calculated in the next run.

Parameters:
p true iff embedding should be calculated.
See Also:
planarity::get_embedding, planar_embedding

bool calc_embedding() const [public]

Returns true if a planar embedding will be calculated in the next run.

Returns:
true iff embedding will be calculated.
See Also:
planarity::get_embedding, planar_embedding

void calc_obstruction(bool p) [public]

If p is true the obstructions to planarity will be calculated in the next run. This implies the calculation of an embedding.

Parameters:
p true iff obstructions to planarity should be calculated.
See Also:
planarity::get_obstruction_edges, planarity::get_obstruction_nodes

bool calc_obstruction() const [public]

Returns true if the obstructions to planarity will be calculated in the next run.

Returns:
true iff obstructions to planarity will be calculated.
See Also:
planarity::get_obstruction_edges, planarity::get_obstruction_nodes

void make_biconnected(bool p) [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.

Parameters:
p true iff graph should be made biconnected.
See Also:
biconnectivity::make_biconnected

bool make_biconnected() const [public]

Returns strategy for testing graphs, which are not biconnected.

Returns:
true iff graph will be made biconnected before test
See Also:
biconnectivity::make_biconnected

bool is_planar() const [public]

Result of last test.

Returns:
true iff graph in last run was planar.

planar_embedding& get_embedding() [public]

If graph in last run was planar a planar embedding is calculated during the reductions. This function gives access to it.

Returns:
planar embedding of graph in last run.
See Also:
planarity::calc_embedding

list<edge>& get_obstruction_edges() [public]

Returns the edges of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar.

Returns:
edges of subgraph homeomorphic to either K3,3 or K5
See Also:
planarity::get_obstruction_nodes, planarity::calc_obstruction

list<node>& get_obstruction_nodes() [public]

Returns the nodes of a subgraph homeomorphic to either K3,3 or K5 if graph in last run was not planar.

Returns:
nodes of subgraph homeomorphic to either K3,3 or K5
See Also:
planarity::get_obstruction_edges, planarity::calc_obstruction

Kdoc