Open
Graph Drawing
Framework

 v.2012.05
 

PlanarSubgraphPQTree.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  
00047 #ifdef _MSC_VER
00048 #pragma once
00049 #endif
00050 
00051 
00052 #ifndef OGDF_PLANAR_SUBGRAPH_PQTREE_H
00053 #define OGDF_PLANAR_SUBGRAPH_PQTREE_H
00054 
00055 
00056 
00057 #include <ogdf/internal/planarity/PQTree.h>
00058 #include <ogdf/basic/Graph.h>
00059 #include <ogdf/basic/SList.h>
00060 #include <ogdf/internal/planarity/PlanarLeafKey.h>
00061 #include <ogdf/internal/planarity/MaxSequencePQTree.h>
00062 
00063 namespace ogdf {
00064 
00065 // Overriding the function doDestruction (see basic.h)
00066 // Allows deallocation of lists of PlanarLeafKey<whaInfo*>
00067 // and PQLeafKey<edge,indInfo*,bool> in constant time using OREAS
00068 // memory management.
00069 
00070 
00071 typedef PQLeafKey<edge,whaInfo*,bool> *PtrPQLeafKeyEWB;
00072 
00073 template<>
00074 inline bool doDestruction<PtrPQLeafKeyEWB>(const PtrPQLeafKeyEWB*) { return false; }
00075 
00076 typedef PlanarLeafKey<whaInfo*> *PtrPlanarLeafKeyW;
00077 
00078 template<>
00079 inline bool doDestruction<PtrPlanarLeafKeyW>(const PtrPlanarLeafKeyW*) { return false; }
00080 
00081 
00082 
00083 class PlanarSubgraphPQTree: public MaxSequencePQTree<edge,bool> {
00084 
00085 public:
00086 
00087     PlanarSubgraphPQTree() : MaxSequencePQTree<edge,bool>() {};
00088 
00089     virtual ~PlanarSubgraphPQTree() {};
00090 
00091     // Initializes a new PQ-tree with a set of leaves.
00092     virtual int Initialize(SListPure<PlanarLeafKey<whaInfo*>*> &leafKeys);
00093         
00094     // Replaces the pertinent subtree by a set of new leaves.
00095     void ReplaceRoot(SListPure<PlanarLeafKey<whaInfo*>*> &leafKeys);
00096 
00097     // Reduces a set of leaves.
00098     virtual bool Reduction(SListPure<PlanarLeafKey<whaInfo*>*> &leafKeys,
00099                            SList<PQLeafKey<edge,whaInfo*,bool>*> &eliminatedKeys);
00100 private:
00101 
00102     // Replaces a pertinet subtree by a set of new leaves if the root 
00103     // is full.
00104     void ReplaceFullRoot(SListPure<PlanarLeafKey<whaInfo*>*> &leafKeys);
00105 
00106     // Replaces a pertinet subtree by a set of new leaves if the root 
00107     // is partial.
00108     void ReplacePartialRoot(SListPure<PlanarLeafKey<whaInfo*>*> &leafKeys);
00109 
00110     // Removes the leaves that have been marked for elimination from the PQ-tree.
00111     void removeEliminatedLeaves(SList<PQLeafKey<edge,whaInfo*,bool>*> &eliminatedKeys);
00112 
00113 };  
00114 
00115 }
00116 
00117 #endif