Open
Graph Drawing
Framework

 v.2012.05
 

FixedUpwardEmbeddingInserter.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 #ifndef OGDF_FIXED_UPWARD_EMBEDDING_INSERTER_H
00048 #define OGDF_FIXED_UPWARD_EMBEDDING_INSERTER_H
00049 
00050 
00051 
00052 #include <ogdf/basic/Module.h>
00053 #include <ogdf/upward/UpwardPlanarModule.h>
00054 #include <ogdf/basic/GraphCopy.h>
00055 #include <ogdf/upward/UpwardPlanRep.h>
00056 
00057 
00058 namespace ogdf {
00059 
00060 
00061 class OGDF_EXPORT FixedUpwardEmbeddingInserter : public Module
00062 {
00063 public:
00064     // construction
00065     FixedUpwardEmbeddingInserter();
00066 
00067     // destruction
00068     ~FixedUpwardEmbeddingInserter(){ }
00069 
00070     // Insert all edges in UPR 
00071     Module::ReturnType call(UpwardPlanRep &UPR, List<edge> origEdges, EdgeArray<int> &cost);
00072 
00073     bool isUpwardPlanar(Graph &G) 
00074     {
00075         UpwardPlanarModule upMod;
00076         return upMod.upwardPlanarityTest(G);    
00077     }
00078 
00079 private:
00080     
00081     const int infty;
00082     
00084     void staticLock(UpwardPlanRep &UPR, EdgeArray<bool> &locked, const List<edge> &origEdges, edge e_orig);
00085 
00087     void dynamicLock(UpwardPlanRep &UPR, EdgeArray<bool> &locked, face f, adjEntry e_cur);
00088 
00089     void nextFeasibleEdges(UpwardPlanRep &UPR, List<adjEntry> &nextEdges, face f, adjEntry e_cur, EdgeArray<bool> &locked); 
00090     
00092     void minFIP(UpwardPlanRep &UPR,
00093                 List<edge> &origEdges,
00094                 EdgeArray<int> &cost, 
00095                 edge e_orig,
00096                 SList<adjEntry> &path) { getPath(UPR, origEdges, cost, e_orig, path, false); }
00097 
00098 
00099 
00101     void constraintFIP(UpwardPlanRep &UPR,
00102                 List<edge> &origEdges,
00103                 EdgeArray<int> &cost, 
00104                 edge e_orig,
00105                 SList<adjEntry> &path) { getPath(UPR, origEdges, cost, e_orig, path, true); }
00106 
00108     void getPath(UpwardPlanRep &UPR,
00109                 List<edge> &origEdges,
00110                 EdgeArray<int> &cost, 
00111                 edge e_orig, 
00112                 SList<adjEntry> &path,
00113                 bool heuristic);
00114 
00115 
00117     void markUp(const Graph &G, node v, EdgeArray<bool> &markedEdges);
00118 
00119 
00121     void markDown(const Graph &G, node v, EdgeArray<bool> &markedEdges);
00122     
00124     void feasibleEdges(UpwardPlanRep &UPR,
00125                         face f, // current face
00126                         adjEntry adj, // current adjEntry, right face muss be f
00127                         EdgeArray<bool> &locked, // we compute the dyn. locked edges on the fly with respect to e
00128                         List<adjEntry> feasible // the list of feasible edges in f with respect to e
00129                         );
00130 
00132     bool isConstraintFeasible(UpwardPlanRep &UPR,
00133                             const List<edge> &orig_edges,
00134                             edge e_orig,
00135                             adjEntry adj, // the last adjEntry of the insertion path
00136                             EdgeArray<adjEntry> &predAdj //Array to reconstruction the insertion path
00137                             );
00138 
00139 
00141     bool isConstraintFeasible(UpwardPlanRep &UPR,
00142                             List<edge> &origEdges,  
00143                             edge e_orig,
00144                             SList<adjEntry> &path); 
00145     
00146 };
00147 
00148 
00149 } // end namespace ogdf
00150 
00151 #endif
00152 
00153