Open
Graph Drawing
Framework

 v.2012.05
 

FaceSinkGraph.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 #ifndef OGDF_FACE_SINK_GRAPH_H
00047 #define OGDF_FACE_SINK_GRAPH_H
00048 
00049 
00050 #include <ogdf/basic/CombinatorialEmbedding.h>
00051 #include <ogdf/basic/NodeArray.h>
00052 #include <ogdf/basic/FaceArray.h>
00053 #include <ogdf/basic/SList.h>
00054 
00055 
00056 namespace ogdf {
00057 
00058 
00059 class OGDF_EXPORT FaceSinkGraph : public Graph
00060 {
00061 public:
00063     FaceSinkGraph(const ConstCombinatorialEmbedding &E, node s);
00064 
00066     FaceSinkGraph() : m_pE(0) { }
00067 
00068 
00069     void init(const ConstCombinatorialEmbedding &E, node s);
00070 
00071 
00073     const Graph &originalGraph() const {
00074         return *m_pE;
00075     }
00076 
00078     const ConstCombinatorialEmbedding  &originalEmbedding() const {
00079         return *m_pE;
00080     }
00081 
00084     node originalNode(node v) const {
00085         return m_originalNode[v];
00086     }
00087 
00090     face originalFace(node v) const {
00091         return m_originalFace[v];
00092     }
00093 
00094     // returns true iff node v in the face-sink graph corresponds to a
00095     // face in E containing the source
00096     bool containsSource(node v) const {
00097         return m_containsSource[v];
00098     }
00099 
00100 
00101     
00102 
00106     node possibleExternalFaces(SList<face> &externalFaces) {
00107         node v_T = checkForest();
00108         if (v_T != 0)
00109             gatherExternalFaces(m_T,0,externalFaces);
00110         return v_T;
00111     }
00112 
00113 
00114     node faceNodeOf(edge e) {
00115         return dfsFaceNodeOf(m_T,0,
00116             m_pE->rightFace(e->adjSource()),m_pE->rightFace(e->adjTarget()));
00117     }
00118 
00119 
00120     node faceNodeOf(face f) {
00121         return dfsFaceNodeOf(m_T,0,f,0);
00122     }
00123 
00124 
00126 
00128     void stAugmentation(
00129         node h,                       // node corresponding to external face
00130         Graph &G,                     // original graph (not const)
00131         SList<node> &augmentedNodes,  // list of augmented nodes
00132         SList<edge> &augmentedEdges); // list of augmented edges
00133 
00135 
00137     void stAugmentation(
00138         node  h,                      // node corresponding to external face
00139         Graph &G,                     // original graph (not const)
00140         node  &superSink,             // super sink
00141         SList<edge> &augmentedEdges); // list of augmented edges
00142 
00144     // the ext. face muss be set
00145     void sinkSwitches(FaceArray< List<adjEntry> > &faceSwitches);
00146 
00147     
00148     
00149 private:
00151     void doInit();
00152 
00154     bool dfsCheckForest(
00155         node v,                   // current node
00156         node parent,              // its parent in tree
00157         NodeArray<bool> &visited, // not already visited ?
00158         // number of internal vertices of G in current tree
00159         int &nInternalVertices);
00160 
00162 
00165     void gatherExternalFaces(
00166         node v,                      // current node
00167         node parent,                 // its parent
00168         SList<face> &externalFaces); // returns list of possible external faces
00169 
00170     node dfsFaceNodeOf(node v, node parent,face f1, face f2);
00171 
00172     node dfsStAugmentation(
00173         node v,                       // current node
00174         node parent,                  // its parent
00175         Graph &G,                     // original graph (not const)
00176         SList<node> &augmentedNodes,  // list of augmented nodes
00177         SList<edge> &augmentedEdges); // list of augmented edges
00178 
00179     node dfsStAugmentation(
00180         node v,                       // current node
00181         node parent,                  // its parent
00182         Graph &G,                     // original graph (not const)
00183         SList<edge> &augmentedEdges); // list of augmented edges
00184 
00185     
00187     const ConstCombinatorialEmbedding *m_pE;
00188     node m_source; 
00189     node m_T;      
00190 
00191     NodeArray<node> m_originalNode;   
00192     NodeArray<face> m_originalFace;   
00193     NodeArray<bool> m_containsSource; 
00194 
00195     /*
00197     void dfsFST(node v, //current node
00198         node parent, //parent of v
00199         FaceArray< List<adjEntry> > &faceSwitches, 
00200         NodeArray<bool> &visited);
00201         */
00202 
00207     node checkForest();
00208 
00209     
00211     adjEntry getAdjEntry(node v, face f);
00212 
00213     
00214 }; // class FaceSinkGraph
00215 
00216 
00217 } // end namespace ogdf
00218 
00219 
00220 #endif