Open
Graph Drawing
Framework

 v.2012.05
 

ogdf::PQNode< T, X, Y > Class Template Reference

#include <ogdf/internal/planarity/PQNode.h>

Inheritance diagram for ogdf::PQNode< T, X, Y >:
ogdf::PQNodeRoot ogdf::PQInternalNode< T, X, Y > ogdf::PQLeaf< T, X, Y >

List of all members.

Public Member Functions

 PQNode (int count, PQNodeKey< T, X, Y > *infoPtr)
 PQNode (int count)
virtual ~PQNode ()
bool changeEndmost (PQNode< T, X, Y > *oldEnd, PQNode< T, X, Y > *newEnd)
bool changeSiblings (PQNode< T, X, Y > *oldSib, PQNode< T, X, Y > *newSib)
bool endmostChild ()
PQNode< T, X, Y > * getEndmost (PQNode< T, X, Y > *other) const
PQNode< T, X, Y > * getEndmost (int side) const
PQNodeKey< T, X, Y > * getNodeInfo () const
 Returns the identification number of a node.
PQNode< T, X, Y > * getSib (int side) const
PQNode< T, X, Y > * getNextSib (PQNode< T, X, Y > *other) const
int identificationNumber () const
 Returns the identification number of a node.
int childCount () const
 Returns the number of children of a node.
void childCount (int count)
 Sets the number of children of a node.
PQNode< T, X, Y > * parent () const
PQNode< T, X, Y > * parent (PQNode< T, X, Y > *newParent)
int parentType () const
 Returns the type of the parent of a node.
void parentType (int newParentType)
int pertChildCount () const
 Returs the number of pertinent children of a node.
void pertChildCount (int count)
 Sets the number of pertinent children of a node.
SibDirection putSibling (PQNode< T, X, Y > *newSib)
SibDirection putSibling (PQNode< T, X, Y > *newSib, int preference)
PQNode< T, X, Y > * referenceChild () const
 Returns a pointer to the reference child if node is a P-node.
PQNode< T, X, Y > * referenceParent () const
 Returns the pointer to the parent if node is a reference child.
bool setNodeInfo (PQNodeKey< T, X, Y > *pointerToInfo)
 Sets the pointer m_pointerToInfo to the specified adress of pointerToInfo.
virtual PQLeafKey< T, X, Y > * getKey () const =0
virtual bool setKey (PQLeafKey< T, X, Y > *pointerToKey)=0
 Sets a specified pointer variable in a derived class to the specified adress of pointerToKey that is of type PQLeafKey.
virtual PQInternalKey< T, X, Y > * getInternal () const =0
virtual bool setInternal (PQInternalKey< T, X, Y > *pointerToInternal)=0
virtual int mark () const =0
virtual void mark (int)=0
 mark() sets the variable m_mark in the derived class PQLeaf and PQInternalNode.
virtual int status () const =0
 Returns the variable m_status in the derived class PQLeaf and PQInternalNode.
virtual void status (int)=0
 Sets the variable m_status in the derived class PQLeaf and PQInternalNode.
virtual PQNodeType type () const =0
 Returns the variable m_type in the derived class PQLeaf and PQInternalNode.
virtual void type (PQNodeType)=0
 Sets the variable m_type in the derived class PQLeaf and PQInternalNode.

Protected Attributes

int m_childCount
 Stores the number of children of the node.
int m_debugTreeNumber
int m_identificationNumber
int m_parentType
 Stores the type of the parent which can be either a P- or Q-node.
int m_pertChildCount
 Stores the number of pertinent children of the node.
int m_pertLeafCount
 Stores the number of pertinent leaves in the frontier of the node.
PQNode< T, X, Y > * m_firstFull
 Stores a pointer to the first full child of a Q-node.
PQNode< T, X, Y > * m_leftEndmost
PQNode< T, X, Y > * m_parent
PQNode< T, X, Y > * m_referenceChild
PQNode< T, X, Y > * m_referenceParent
PQNode< T, X, Y > * m_rightEndmost
 Stores the right endmost child of a Q-node.
PQNode< T, X, Y > * m_sibLeft
PQNode< T, X, Y > * m_sibRight
PQNodeKey< T, X, Y > * m_pointerToInfo
 Stores a pointer to the corresponding information of the node.
List< PQNode< T, X, Y > * > * fullChildren
 Stores all full children of a node during a reduction.
List< PQNode< T, X, Y > * > * partialChildren
 Stores all partial children of a node during a reduction.

Friends

class PQTree< T, X, Y >

Detailed Description

template<class T, class X, class Y>
class ogdf::PQNode< T, X, Y >

Definition at line 88 of file PQNode.h.


Constructor & Destructor Documentation

template<class T, class X, class Y>
ogdf::PQNode< T, X, Y >::PQNode ( int  count,
PQNodeKey< T, X, Y > *  infoPtr 
)

The (first) constructor combines the node with its information and will automatically set the m_nodePointer (see basicKey) of the element of type PQNodeKey.

Definition at line 614 of file PQNode.h.

template<class T, class X, class Y>
ogdf::PQNode< T, X, Y >::PQNode ( int  count)

The (second) constructor is called, if no information is available or neccessary.

Definition at line 646 of file PQNode.h.

template<class T, class X, class Y>
virtual ogdf::PQNode< T, X, Y >::~PQNode ( ) [inline, virtual]

The destructor does not delete any accompanying information class as PQLeafKey, PQNodeKey and PQInternalKey. This has been avoided, since applications may need the existence of these information classes after the corresponding node has been deleted. If the deletion of an accompanying information class should be performed with the deletion of a node, either derive a new class with an appropriate destructor, or make use of the function CleanNode() of the class template PQTree.

Definition at line 123 of file PQNode.h.


Member Function Documentation

template<class T, class X, class Y>
bool ogdf::PQNode< T, X, Y >::changeEndmost ( PQNode< T, X, Y > *  oldEnd,
PQNode< T, X, Y > *  newEnd 
)

The function changeEndmost() replaces the old endmost child oldEnd of the node by a new child newEnd. If the node is a Q-node, then it must have two valid pointers to its endmost children. If one of the endmost children is oldEnd, it is replaced by newEnd. The function changeEndmost() returns 1 if it succeeded in replacing oldEnd by newEnd. Otherwise the function returns 0, leaving with an error message.

Definition at line 562 of file PQNode.h.

template<class T, class X, class Y>
bool ogdf::PQNode< T, X, Y >::changeSiblings ( PQNode< T, X, Y > *  oldSib,
PQNode< T, X, Y > *  newSib 
)

The function changeSiblings() replaces the old sibling oldSib of the node by a new sibling newSib. If the node has oldSib as sibling, then it changes the sibling pointer that references to oldSib and places newSib at its position. The function changeSiblings() returns 1 if it succeeded in replacing oldSib by newSib. Otherwise the function returns 0, leaving with an error message.

Definition at line 591 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::childCount ( ) const [inline]

Returns the number of children of a node.

Definition at line 237 of file PQNode.h.

template<class T, class X, class Y>
void ogdf::PQNode< T, X, Y >::childCount ( int  count) [inline]

Sets the number of children of a node.

Definition at line 240 of file PQNode.h.

template<class T, class X, class Y>
bool ogdf::PQNode< T, X, Y >::endmostChild ( ) [inline]

The function endmostChild() checks if a node is endmost child of a Q-node. This is 1 if one of the sibling pointers m_sibLeft or m_sibRight is 0. If the node is endmost child of a Q-node, then it has a valid parent pointer.

Definition at line 161 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::getEndmost ( PQNode< T, X, Y > *  other) const [inline]

Returns one of the endmost children of node, if node is a Q-node. The function getEndmost() accepts as input a pointer to a PQNode stored in other. The returned endmost child is unequal to the one specified in other. In case that an arbitrary endmost child should be looked up, set other = 0. This makes the function getEndmost() return an arbitrary endmost child (it returns the left endmost child).

Definition at line 174 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::getEndmost ( int  side) const [inline]

Returns one of the endmost children of node, if node is a Q-node. The function accepts an integer denoting a direction causing the function to return either the left or the endmost child.

Definition at line 188 of file PQNode.h.

template<class T, class X, class Y>
virtual PQInternalKey<T,X,Y>* ogdf::PQNode< T, X, Y >::getInternal ( ) const [pure virtual]

getInternal() returns a pointer to the PQInternalKey information of a node, in case that the node is supposed to have PQInternalKey information, such as elements of the derived class template PQInternalNode. The internal information is of type PQInternalKey.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
virtual PQLeafKey<T,X,Y>* ogdf::PQNode< T, X, Y >::getKey ( ) const [pure virtual]

getKey() returns a pointer to the PQLeafKeyof a node, in case that the node is supposed to have a key, such as elements of the derived class template PQLeaf. The key contains information and is of type PQLeafKey.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::getNextSib ( PQNode< T, X, Y > *  other) const [inline]

The function getNextSib() returns one of the siblings of the node. The function getNextSib() accepts as input a pointer to a PQNode stored in other. The returned sibling is unequal to the one specified in other. In case that no sibling has been looked up before, set other = 0. This makes the function getNextSib() return an arbitrary sibling (it returns the left sibling).

Definition at line 223 of file PQNode.h.

template<class T, class X, class Y>
PQNodeKey<T,X,Y>* ogdf::PQNode< T, X, Y >::getNodeInfo ( ) const [inline]

Returns the identification number of a node.

Definition at line 198 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::getSib ( int  side) const [inline]

The function getSib() returns one of the siblings of the node. It accepts an integer denoting a dircetion causing the function to return either the left or the right sibling.

Definition at line 205 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::identificationNumber ( ) const [inline]

Returns the identification number of a node.

Definition at line 234 of file PQNode.h.

template<class T, class X, class Y>
virtual int ogdf::PQNode< T, X, Y >::mark ( ) const [pure virtual]

mark() returns the variable m_mark in the derived class PQLeaf and PQInternalNode. In a derived class this function has to return the designation used in the first pass of Booth and Luekers algorithm called Bubble(). A node then is either marked BLOCKED, UNBLOCKED or QUEUED (see PQNode).

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
virtual void ogdf::PQNode< T, X, Y >::mark ( int  ) [pure virtual]

mark() sets the variable m_mark in the derived class PQLeaf and PQInternalNode.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::parent ( ) const [inline]

The function parent() returns a pointer to the parent of a node.

Warning:
After reducing the PQ-tree, some nodes may not have valid parent pointers anymore. This is no fault, the datastructur was designed this way. See also Booth and Lueker.

Definition at line 249 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::parent ( PQNode< T, X, Y > *  newParent) [inline]

Sets the parent pointer of a node. This function is needed in more ellaborated algorithms implemented as derivation of the class template PQTree. Here, the parent pointer probably is always needed and therefore has to be set within special functions, used in a pre-run before applying the bubble Phase of the PQTree.

Definition at line 258 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::parentType ( ) const [inline]

Returns the type of the parent of a node.

Definition at line 264 of file PQNode.h.

template<class T, class X, class Y>
void ogdf::PQNode< T, X, Y >::parentType ( int  newParentType) [inline]

Sets the type of the parent of a node. This does not change the type of the parent!

Definition at line 270 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::pertChildCount ( ) const [inline]

Returs the number of pertinent children of a node.

Definition at line 273 of file PQNode.h.

template<class T, class X, class Y>
void ogdf::PQNode< T, X, Y >::pertChildCount ( int  count) [inline]

Sets the number of pertinent children of a node.

Definition at line 276 of file PQNode.h.

template<class T, class X, class Y>
SibDirection ogdf::PQNode< T, X, Y >::putSibling ( PQNode< T, X, Y > *  newSib) [inline]

The default function putSibling() stores a new sibling at a free sibling pointer of the node. This is only possible, if the node has at most one sibling. The function then detects a non used sibling pointer and places newSib onto it. putSibling() returns 0 if there have been two siblings detected, occupying the two possible pointers. In this case the new sibling newSib cannot be stored. If there was at a maximum one sibling stored, the function will place newSib on the free pointer and return either LEFT or RIGHT, depending wich pointer has been used.

This function will always scan the pointer to the left brother first.

Definition at line 291 of file PQNode.h.

template<class T, class X, class Y>
SibDirection ogdf::PQNode< T, X, Y >::putSibling ( PQNode< T, X, Y > *  newSib,
int  preference 
) [inline]

The function putSibling() with preference stores a new sibling at a free sibling pointer of the node. This is only possible, if the node has at most one sibling. The function then detects a non used sibling pointer and places newSib onto it. putSibling() returns 0 if there have been two siblings detected, occupying the two possible pointers. In this case the new sibling newSib could not be stored. If there was at a maximum one sibling stored, the function will place newSib on the free pointer and return either LEFT or RIGHT, depending wich pointer has been used.

This function scans the brother first, which has been specified in the preference. If the preference has value LEFT, it scans the pointer to the left brother first. If the value is RIGHT, it scans the pointer to the right brother first.

Definition at line 319 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::referenceChild ( ) const [inline]

Returns a pointer to the reference child if node is a P-node.

Definition at line 339 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::referenceParent ( ) const [inline]

Returns the pointer to the parent if node is a reference child.

Definition at line 342 of file PQNode.h.

template<class T, class X, class Y>
virtual bool ogdf::PQNode< T, X, Y >::setInternal ( PQInternalKey< T, X, Y > *  pointerToInternal) [pure virtual]
template<class T, class X, class Y>
virtual bool ogdf::PQNode< T, X, Y >::setKey ( PQLeafKey< T, X, Y > *  pointerToKey) [pure virtual]

Sets a specified pointer variable in a derived class to the specified adress of pointerToKey that is of type PQLeafKey.

If a derived class, such as PQInternalNode, is not supposed to store informations of type PQLeafKey, setKey() ignores the informations as long as pointerToKey = 0. The return value then is 1. In case that pointerToKey != 0, the return value is 0.

If a derived class, such as PQLeaf is supposed to store informations of type PQLeafKey, pointerToKey has to be instantiated by the client. The function setKey() does not instantiate the corresponding variable in the derived class. The return value is always 1 unless pointerKey was equal to 0.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
bool ogdf::PQNode< T, X, Y >::setNodeInfo ( PQNodeKey< T, X, Y > *  pointerToInfo) [inline]

Sets the pointer m_pointerToInfo to the specified adress of pointerToInfo.

Definition at line 345 of file PQNode.h.

template<class T, class X, class Y>
virtual int ogdf::PQNode< T, X, Y >::status ( ) const [pure virtual]

Returns the variable m_status in the derived class PQLeaf and PQInternalNode.

Its objective is to manage status of a node in the PQ-tree. A status is any kind of information of the current situation in the frontier of a node (the frontier of a node are all descendant leaves of the node). A status is anything such as EMPTY, FULL or PARTIAL (see PQNode). Since there might be more than those three possibilities, (e.g. in computing planar subgraphs this function probably has to be overloaded by the client.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
virtual void ogdf::PQNode< T, X, Y >::status ( int  ) [pure virtual]

Sets the variable m_status in the derived class PQLeaf and PQInternalNode.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
virtual PQNodeType ogdf::PQNode< T, X, Y >::type ( ) const [pure virtual]

Returns the variable m_type in the derived class PQLeaf and PQInternalNode.

Its objective it to manage the type of a node. node the current node is. The type of a node in the class template PQTree is either PNode, QNode or leaf (see PQNode). There may be of course more types such as sequence indicators.

Observe that the derived class template PQLeaf does not have a variable m_type, since it obviously is of type leaf.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.

template<class T, class X, class Y>
virtual void ogdf::PQNode< T, X, Y >::type ( PQNodeType  ) [pure virtual]

Sets the variable m_type in the derived class PQLeaf and PQInternalNode.

Implemented in ogdf::PQInternalNode< T, X, Y >, ogdf::PQLeaf< T, X, Y >, and ogdf::EmbedIndicator.


Friends And Related Function Documentation

template<class T, class X, class Y>
friend class PQTree< T, X, Y > [friend]

All members and member function of PQNode are needed by the class template PQTree. Therefore the class PQTree was made friendof PQNode, since this prevents the use of a large amount of extra public functions.

Definition at line 96 of file PQNode.h.


Member Data Documentation

template<class T, class X, class Y>
List<PQNode<T,X,Y>*>* ogdf::PQNode< T, X, Y >::fullChildren [protected]

Stores all full children of a node during a reduction.

Definition at line 543 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_childCount [protected]

Stores the number of children of the node.

Definition at line 457 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_debugTreeNumber [protected]

Needed for debuging purposes. The PQ-trees can be visualized with the help of the Tree Interface and the m_debugTreeNumber is needed to print out the tree in the correct file format.

Definition at line 465 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_firstFull [protected]

Stores a pointer to the first full child of a Q-node.

Definition at line 490 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_identificationNumber [protected]

Each node that has been introduced once into the tree gets a unique number. If the node is removed from the tree during a reduction or with the help of one of the functions that is provided by the class template PQtree, its number is not reused. This always allows exact identification of nodes during any process that is envoked on the PQ-tree. We strongly recommend users who construct the tree with the help of the construction functions and who instantiate the nodes by them selves to do the same.

Definition at line 478 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_leftEndmost [protected]

Definition at line 492 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_parent [protected]

Is a pointer to the parent. Observe that this pointer may not be up to date after a few applications of the reduction.

Definition at line 499 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_parentType [protected]

Stores the type of the parent which can be either a P- or Q-node.

Definition at line 481 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_pertChildCount [protected]

Stores the number of pertinent children of the node.

Definition at line 484 of file PQNode.h.

template<class T, class X, class Y>
int ogdf::PQNode< T, X, Y >::m_pertLeafCount [protected]

Stores the number of pertinent leaves in the frontier of the node.

Definition at line 487 of file PQNode.h.

template<class T, class X, class Y>
PQNodeKey<T,X,Y>* ogdf::PQNode< T, X, Y >::m_pointerToInfo [protected]

Stores a pointer to the corresponding information of the node.

Definition at line 539 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_referenceChild [protected]

Stores a pointer to one child, the reference child of the doubly linked cirkular list of children of a P-node. With the help of this pointer, it is possible to access the children of the P-node

Definition at line 507 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_referenceParent [protected]

Is a pointer to the parent, in case that the parent is a P-node and the node itself is its reference child. The pointer is needed in order to identify the reference child among all children of a P-node.

Definition at line 515 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_rightEndmost [protected]

Stores the right endmost child of a Q-node.

Definition at line 518 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_sibLeft [protected]

Stores a pointer ot the left sibling of PQNode. If PQNode is child of a Q-node and has no left sibling, m_sibLeft is set to 0. If PQNode is child of a P-node, all children of the P-node are linked in a cirkular list. In the latter case, m_sibLeft is never 0.

Definition at line 527 of file PQNode.h.

template<class T, class X, class Y>
PQNode<T,X,Y>* ogdf::PQNode< T, X, Y >::m_sibRight [protected]

Stores a pointer ot the right sibling of PQNode. If PQNode is child of a Q-node and has no right sibling, \ m_sibRight is set to 0. If PQNode is child of a P-node, all children of the P-node are linked in a cirkular list. In the latter case, m_sibRight is never 0.

Definition at line 536 of file PQNode.h.

template<class T, class X, class Y>
List<PQNode<T,X,Y>*>* ogdf::PQNode< T, X, Y >::partialChildren [protected]

Stores all partial children of a node during a reduction.

Definition at line 546 of file PQNode.h.


The documentation for this class was generated from the following file: