pq_tree Class Reference

PQ-Trees. More...

List of all members.

Public Member Functions

 pq_tree ()
 Creates empty pq_tree.
 pq_tree (int id, node n, const list< pq_leaf * > &le)
 Creates a PQ-tree consisting of a single P-node whose whose children are the leaves given in list le.
 ~pq_tree ()
 Deletes PQ-tree.
bool reduce (list< pq_leaf * > &leaves)
 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.
void replace_pert (int id, node n, const list< pq_leaf * > &le, planar_embedding *em=0, list< direction_indicator > *dirs=0)
 Replaces all the pertinent parts of the PQ-tree after a (successful) reduction by a new P-node, whose children are given in le.
void get_frontier (planar_embedding &em, list< direction_indicator > &dirs)
 Scans whole tree from left to right and stores edges (in the graph) represented by the leaves in em.
void reset ()
 After a (successful) reduction reset has to be called in order to prepare the tree for the next reduction.
pq_node * get_fail ()
 Returns the (PQ-) node to which none of the template matchings were applicable.
bool is_fail_root ()
 Returns true iff fail is the root of the pertinent subtree.
sons_iterator remove_dir_ind (q_node *q_fail, sons_iterator s_it)
 Remove a direction indicator among sons of a Q-node. Needed for computation of the obstruction set.
bool integrity_check () const
 Checks the structure of the tree.


Detailed Description

PQ-Trees.

Date
Revision

Constructor & Destructor Documentation

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

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

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


Member Function Documentation

bool pq_tree::reduce ( list< pq_leaf * > &  leaves  ) 

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
Return values:
true if tree was successfully reduced
false if reduction failed

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

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:
id st-number of n
n node in the graph to which the new P-node refers
le list of children
em planar embedding
dirs direction indicators in pertinent subtree

void pq_tree::get_frontier ( planar_embedding em,
list< direction_indicator > &  dirs 
)

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:
em planar embedding
dirs direction indicators in tree

pq_node* pq_tree::get_fail (  )  [inline]

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

Returns:
PQ-node at which the reduction failed

bool pq_tree::is_fail_root (  )  [inline]

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

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

sons_iterator pq_tree::remove_dir_ind ( q_node *  q_fail,
sons_iterator  s_it 
)

Remove a direction indicator among sons of a Q-node. Needed for computation of the obstruction set.

Parameters:
q_fail the Q-node on which the reduction failed
the position of the direction indicator among the sons
Return values:
next valid sons iterator

bool pq_tree::integrity_check (  )  const

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.
Return values:
true iff tree passes checks