Open
Graph Drawing
Framework

 v.2012.05
 

EmbedPQTree.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00042 #ifdef _MSC_VER
00043 #pragma once
00044 #endif
00045 
00046 
00047 
00048 #ifndef OGDF_EMBED_PQTREE_H
00049 #define OGDF_EMBED_PQTREE_H
00050 
00051 #include <ogdf/internal/planarity/PQTree.h>
00052 #include <ogdf/basic/Graph.h>
00053 #include <ogdf/basic/SList.h>
00054 #include <ogdf/internal/planarity/PlanarLeafKey.h>
00055 #include <ogdf/internal/planarity/EmbedIndicator.h>
00056 
00057 namespace ogdf {
00058 
00059 typedef PQBasicKey<edge,indInfo*,bool> *PtrPQBasicKeyEIB;
00060 
00061 template<>
00062 inline bool doDestruction<PtrPQBasicKeyEIB>(const PtrPQBasicKeyEIB*) { return false; }
00063 
00064 
00065 typedef PlanarLeafKey<indInfo*> *PtrPlanarLeafKeyI;
00066 
00067 template<>
00068 inline bool doDestruction<PtrPlanarLeafKeyI>(const PtrPlanarLeafKeyI*) { return false; }
00069 
00070 
00071 class EmbedPQTree: public PQTree<edge,indInfo*,bool>
00072 {
00073 public:
00074 
00075     EmbedPQTree() : PQTree<edge,indInfo*,bool>() { }
00076 
00077     virtual ~EmbedPQTree() { }
00078 
00079     virtual void emptyAllPertinentNodes();
00080 
00081     virtual void clientDefinedEmptyNode(PQNode<edge,indInfo*,bool>* nodePtr);
00082 
00083     virtual int Initialize(SListPure<PlanarLeafKey<indInfo*>*> &leafKeys);
00084         
00085     void ReplaceRoot(
00086         SListPure<PlanarLeafKey<indInfo*>*> &leafKeys,
00087         SListPure<edge> &frontier,
00088         SListPure<node> &opposed,
00089         SListPure<node> &nonOpposed,
00090         node v);
00091 
00092     virtual bool Reduction(SListPure<PlanarLeafKey<indInfo*>*> &leafKeys);
00093 
00094     PQNode<edge,indInfo*,bool>* scanSibLeft(PQNode<edge,indInfo*,bool> *nodePtr) const {
00095         return clientSibLeft(nodePtr);
00096     } 
00097 
00098     PQNode<edge,indInfo*,bool>* scanSibRight(PQNode<edge,indInfo*,bool> *nodePtr) const {
00099         return clientSibRight(nodePtr);
00100     } 
00101 
00102     PQNode<edge,indInfo*,bool>* scanLeftEndmost(PQNode<edge,indInfo*,bool> *nodePtr) const {
00103         return clientLeftEndmost(nodePtr);
00104     } 
00105 
00106     PQNode<edge,indInfo*,bool>* scanRightEndmost(PQNode<edge,indInfo*,bool> *nodePtr) const {
00107         return clientRightEndmost(nodePtr);
00108     } 
00109 
00110     PQNode<edge,indInfo*,bool>* scanNextSib(
00111         PQNode<edge,indInfo*,bool> *nodePtr, 
00112         PQNode<edge,indInfo*,bool> *other) {
00113             return clientNextSib(nodePtr,other);
00114     } 
00115 
00116     virtual void getFront(
00117         PQNode<edge,indInfo*,bool>* nodePtr,
00118         SListPure<PQBasicKey<edge,indInfo*,bool>*> &leafKeys);
00119 
00120 protected:
00121 
00122     virtual PQNode<edge,indInfo*,bool>*
00123         clientSibLeft(PQNode<edge,indInfo*,bool> *nodePtr) const;
00124 
00125     virtual PQNode<edge,indInfo*,bool>*
00126         clientSibRight(PQNode<edge,indInfo*,bool> *nodePtr) const; 
00127 
00128     virtual PQNode<edge,indInfo*,bool>*
00129         clientLeftEndmost(PQNode<edge,indInfo*,bool> *nodePtr) const;
00130 
00131     virtual PQNode<edge,indInfo*,bool>*
00132         clientRightEndmost(PQNode<edge,indInfo*,bool> *nodePtr) const;
00133 
00134     virtual PQNode<edge,indInfo*,bool>*
00135         clientNextSib(PQNode<edge,indInfo*,bool> *nodePtr, 
00136                       PQNode<edge,indInfo*,bool> *other) const;
00137     virtual const char* 
00138         clientPrintStatus(PQNode<edge,indInfo*,bool> *nodePtr);
00139 
00140     virtual void front(
00141         PQNode<edge,indInfo*,bool>* nodePtr,
00142         SListPure<PQBasicKey<edge,indInfo*,bool>*> &leafKeys);
00143 
00144 private:
00145 
00146     void ReplaceFullRoot(
00147         SListPure<PlanarLeafKey<indInfo*>*> &leafKeys,
00148         SListPure<PQBasicKey<edge,indInfo*,bool>*> &frontier,
00149         node v,
00150         bool addIndicator = false,
00151         PQNode<edge,indInfo*,bool> *opposite = 0);
00152 
00153     void ReplacePartialRoot(
00154         SListPure<PlanarLeafKey<indInfo*>*> &leafKeys,
00155         SListPure<PQBasicKey<edge,indInfo*,bool>*> &frontier,
00156         node v);
00157 };  
00158 
00159 }
00160 
00161 #endif