pq_tree Class Reference

[Index] [Hierarchy] [Headers]


PQ-Trees. More...

#include <GTL/pq_tree.h>

Public Members


pq_tree() [public]

Creates empty pq_tree

pq_tree(int id, node n, const list<pq_leaf*>& le) [public]

Creates PQ-tree consiting of a single P-node whose children are the leaves given in list le.

Parameters:
le list of children
id st-number of n
n node in the graph to which the P-node refers

~pq_tree() [public]

Deletes PQ-tree.

bool reduce(list<pq_leaf*>& leaves) [public]

Applies so called template matchings to the tree until either all leaves labeled with id are consecutive in all equivalent trees or until it is recognized that this can't be achieved.

This operation is guaranteed to perform in O(PPT), where PPT is the size of the so called pruned pertinent subtree, which can be constructed, by cutting away all the parts of the pq_tree, that do not contain a leaf labeled with id.

Parameters:
leaves list of full leaves
Returns:
true iff tree was successfully reduced

void replace_pert( int id, node n, const list<pq_leaf*>& le, planar_embedding* em = 0, list<direction_indicator>* dirs = 0) [public]

Replaces all the pertinent parts of the pq_tree after a (successful) reduction by a new P-node, whose children are given in le. The edges (in the graph), represented by the leaves are stored in left to right order in em[n]; they form (up to reversion) the so called upward-embedding. A direction indicator representing the direction in which the leaves were scanned is added to the sons of the root of the pertinent subtree (if neccessary). All direction indicators in the pertinent subtree are stored in dirs.

Parameters:
le list of children
dirs direction indicators in pertinent subtree
em planar embedding
id st-number of n
n node in the graph to which the new P-node refers

void get_frontier(planar_embedding& em, list<direction_indicator>& dirs) [public]

Scans whole tree from left to right and stores edges (in the graph) represented by the leaves in em. All direction indicators in the tree are stored in dirs. This is used in planarity test to get the upward embedding of the last node, because no reduction is needed in this case since all leaves are labeled with the same number.

Parameters:
dirs direction indicators in tree
em planar embedding

void reset() [public]

After a (successful) reduction reset has to be called in order to prepare the tree for the next reduction.

pq_node* get_fail() [public]

Returns the (PQ-) node to which none of the template matchings were applicable.

Returns:
(PQ-) node at which the reduction failed

bool is_fail_root() [public]

Returns true iff fail is the root of the pertinent subtree.

Returns:
true iff reduction failed at the root of the pertinent subtree.

bool integrity_check() const [public]

Checks the structure of the tree. Note: use this only for debugging since it scans the whole tree, which isn't acceptable in terms of performance in most cases.

Returns:
true iff tree passes checks

Kdoc