Open
Graph Drawing
Framework

 v.2012.05
 

FindKuratowskis.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  
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046 
00047 #ifndef OGDF_FIND_KURATOWSKIS_H
00048 #define OGDF_FIND_KURATOWSKIS_H
00049 
00050 #include <ogdf/internal/planarity/BoyerMyrvoldPlanar.h>
00051 
00052 #define KURATOWSKI_FILE "../Kuratowski"
00053 
00054 namespace ogdf {
00055 
00056 
00058 
00061 struct ExternE {
00062     node theNode;
00063     SListPure<int> startnodes;
00064     SListPure<node> endnodes;
00065     SListPure<SListPure<edge> > externalPaths;
00066 };
00067 
00069 
00071 struct WInfo {
00072     public:
00073         node w;
00074         
00076         enum enumMinorType {
00077             A=0x0001, // minor A
00078             B=0x0002, // minor B
00079             C=0x0004, // minor C
00080             D=0x0008, // minor D
00081             E=0x0010  // minor E
00082         };
00083         int minorType;
00084         
00085         SListPure<adjEntry>* highestXYPath;
00086         SListPure<adjEntry>* zPath;
00087         
00088         bool pxAboveStopX;
00089         bool pyAboveStopY;
00090         
00091         SListPure<SListPure<edge> > pertinentPaths;
00092         
00093         SListIterator<ExternE> externEStart;
00094         SListIterator<ExternE> externEEnd;
00095         node firstExternEAfterW;
00096 };
00097 
00099 class OGDF_EXPORT KuratowskiStructure {
00100         friend class FindKuratowskis;
00101         friend class ExtractKuratowskis;
00102     public:
00104         KuratowskiStructure() { };
00106         ~KuratowskiStructure() { };
00107         
00109         KuratowskiStructure(const KuratowskiStructure& orig) {
00110             copy(orig);
00111         }
00112         
00114         KuratowskiStructure& operator=(const KuratowskiStructure& orig) {
00115             copy(orig);
00116             return *this;
00117         }
00118         
00120         void clear();
00121         
00123         node V;
00125         int V_DFI;
00126         
00128         node R;
00130 
00132         node RReal;
00134         node stopX;
00136         node stopY;
00137         
00138     protected:
00140 
00143         SListPure<WInfo> wNodes;
00144         
00146 
00150         ListPure<adjEntry> highestFacePath;
00151         
00153         SListPure<SListPure<adjEntry> > highestXYPaths;
00154         
00156         SListPure<adjEntry> externalFacePath;
00157         
00159         SListPure<edge> externalSubgraph;
00160         
00162         SListPure<edge> pertinentSubgraph;
00163         
00165 
00167         SListPure<SListPure<adjEntry> > zPaths;
00168         
00170         SListPure<ExternE> externE;
00171         
00173         SListPure<int> stopXStartnodes;
00175         SListPure<int> stopYStartnodes;
00177         SListPure<node> stopXEndnodes;
00179         SListPure<node> stopYEndnodes;
00180         
00182         void copy(const KuratowskiStructure& orig);
00184         void copyPointer(const KuratowskiStructure& orig, SListPure<WInfo>& list);
00185 };
00186 
00188 
00190 class FindKuratowskis {
00191     public:
00193         FindKuratowskis(BoyerMyrvoldPlanar* bm);
00195         ~FindKuratowskis() { };
00196         
00198         void addKuratowskiStructure(
00199                         const node currentNode,
00200                         const node root,
00201                         const node stopx,
00202                         const node stopy);
00203         
00205         inline SListPure<KuratowskiStructure>& getAllKuratowskis() {
00206             return allKuratowskis;
00207         }
00208         
00210         inline const SListPure<KuratowskiStructure>& getAllKuratowskis() const {
00211             return allKuratowskis;
00212         }
00213         
00214         // avoid automatic creation of assignment operator
00216         FindKuratowskis &operator=(const FindKuratowskis &);
00217 
00218     protected:
00220         BoyerMyrvoldPlanar* pBM;
00221         
00223         Graph& m_g;
00224         
00226         const int& m_embeddingGrade;
00227         
00229         const bool m_bundles;
00230         
00232         NodeArray<WInfo*> m_getWInfo;
00233         
00235         SListPure<KuratowskiStructure> allKuratowskis;
00236         
00238         KuratowskiStructure k;
00239         
00241 
00243         int m_nodeMarker;
00245         NodeArray<int> m_wasHere;
00246         
00248 
00250         const NodeArray<node>& m_realVertex;
00251         
00253         const NodeArray<int>& m_dfi;
00254         
00256         const Array<node>& m_nodeFromDFI;
00257         
00259 
00261         const NodeArray<adjEntry>(& m_link)[2];
00262         
00264         const NodeArray<adjEntry>& m_adjParent;
00265         
00267 
00269         const NodeArray<int>& m_leastAncestor;
00270         
00272 
00279         EdgeArray<int>& m_edgeType;
00280         
00282         NodeArray<int>& m_lowPoint;
00283         
00285         const NodeArray<int>& m_highestSubtreeDFI;
00286         
00288 
00290         const NodeArray<ListPure<node> >& m_separatedDFSChildList;
00291         
00293         const EdgeArray<node>& m_pointsToRoot;
00294         
00296 
00298         NodeArray<int>& m_visitedWithBackedge;
00299         
00301 
00304         NodeArray<SListPure<adjEntry> >& m_backedgeFlags;
00305         
00307         NodeArray<SListPure<node> >& m_pertinentRoots;
00308         
00310         node findRoot(node stopX);
00311         
00313         void extractHighestFacePath(ListPure<adjEntry>& highestFacePath, int marker);
00314         
00316         void extractExternalFacePath(
00317                     SListPure<adjEntry>& externalFacePath,
00318                     const ListPure<adjEntry>& highestFacePath,
00319                     int marker,
00320                     int highMarker);
00321         
00323         void splitInMinorTypes(
00324                 const SListPure<adjEntry>& externalFacePath,
00325                 int marker);
00326         
00328         void extractExternalSubgraph(
00329                 const node stop,
00330                 int root,
00331                 SListPure<int>& externalStartnodes,
00332                 SListPure<node>& externalEndnodes);
00334         void extractExternalSubgraphBundles(
00335                 const node stop,
00336                 int root,
00337                 SListPure<edge>& externalSubgraph,
00338                 int nodeMarker);
00339         
00341         void extractPertinentSubgraph(
00342                 SListPure<WInfo>& W_All/*,
00343                 const node V*/);
00345         void extractPertinentSubgraphBundles(
00346                 const SListPure<WInfo>& W_All,
00347                 const node V,
00348                 SListPure<edge>& pertinentSubgraph,
00349                 int nodeMarker);
00350 };
00351 
00352 }
00353 
00354 #endif