Open
Graph Drawing
Framework

 v.2012.05
 

PlanarModule.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  
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047 
00048 #ifndef OGDF_PLANAR_MODULE_H
00049 #define OGDF_PLANAR_MODULE_H
00050 
00051 //=========================================================
00052 // Main functions:
00053 //
00054 // planarityTest(Graph &G)  Tests a graph for planarity.
00055 //
00056 // planarEmbed(Graph &G)  Tests a graph for planarity and returns
00057 //                        a planar embedding if G is planar.
00058 //
00059 //=========================================================
00060 
00061 #include <ogdf/basic/EdgeArray.h>
00062 #include <ogdf/basic/NodeArray.h>
00063 #include <ogdf/basic/SList.h>
00064 
00065 namespace ogdf {
00066 
00067 
00068 class OGDF_EXPORT PlanarModule{
00069 
00070 public:
00071 
00072     PlanarModule() {};
00073     ~PlanarModule() {};
00074 
00075     // Returns true, if G is planar, false otherwise.
00076     bool planarityTest(Graph &G);
00077     bool planarityTest(const Graph &G);
00078 
00079     // Returns true, if G is planar, false otherwise.
00080     // If true, G contains a planar embedding.
00081     bool planarEmbed(Graph &G){return preparation(G,true);}
00082 
00083 private:
00084 
00085     // Prepares the planarity test and the planar embedding
00086     bool preparation(Graph &G,bool embed);
00087 
00088     // Performs a planarity test on a biconnected component
00089     // of G. numbering contains an st-numbering of the component.
00090     bool doTest(Graph &G,NodeArray<int> &numbering);
00091 
00092     // Performs a planarity test on a biconnected component
00093     // of G and embedds it planar. 
00094     // numbering contains an st-numbering of the component.
00095     bool doEmbed(Graph &G,
00096                  NodeArray<int>  &numbering,
00097                  EdgeArray<edge> &backTableEdges,
00098                  EdgeArray<edge> &forwardTableEdges);
00099 
00100     // Used by doEmbed. Computes an entire embedding from an
00101     // upward embedding.
00102     void entireEmbed(Graph &G,
00103                      NodeArray<SListPure<adjEntry> > &entireEmbedding,
00104                      NodeArray<SListIterator<adjEntry> > &adjMarker,
00105                      NodeArray<bool> &mark,
00106                      node v);
00107 
00108     void prepareParallelEdges(Graph &G);
00109 
00110 
00111     //private Members for handling parallel edges
00112     EdgeArray<ListPure<edge> > m_parallelEdges;
00113     EdgeArray<bool> m_isParallel;
00114     int m_parallelCount;
00115 
00116 
00117 
00118 };
00119 
00120 }
00121 #endif