Open
Graph Drawing
Framework

 v.2012.05
 

SubgraphUpwardPlanarizer.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  
00041 #ifndef OGDF_SUBGRAPH_UPWARD_PLANARIZER_H
00042 #define OGDF_SUBGRAPH_UPWARD_PLANARIZER_H
00043 
00044 
00045 #include <ogdf/basic/ModuleOption.h>
00046 #include <ogdf/module/AcyclicSubgraphModule.h>
00047 #include <ogdf/module/FUPSModule.h>
00048 #include <ogdf/module/UpwardEdgeInserterModule.h>
00049 #include <ogdf/module/UpwardPlanarizerModule.h>
00050 #include <ogdf/upward/UpwardPlanRep.h>
00051 #include <ogdf/upward/FUPSSimple.h>
00052 #include <ogdf/upward/FixedEmbeddingUpwardEdgeInserter.h>
00053 #include <ogdf/decomposition/BCTree.h>
00054 #include <ogdf/module/AcyclicSubgraphModule.h>
00055 #include <ogdf/layered/GreedyCycleRemoval.h>
00056 
00057 
00058 namespace ogdf
00059 {
00060 
00061 
00062 class OGDF_EXPORT SubgraphUpwardPlanarizer : public UpwardPlanarizerModule
00063 {       
00064 
00065 public:
00067     SubgraphUpwardPlanarizer()
00068     {
00069          m_runs = 1;        
00070         //set default module
00071         m_subgraph.set(new FUPSSimple());
00072         m_inserter.set(new FixedEmbeddingUpwardEdgeInserter());
00073         m_acyclicMod.set(new GreedyCycleRemoval());
00074     }
00075 
00077     void setSubgraph(FUPSModule *FUPS) {
00078         m_subgraph.set(FUPS);
00079     }
00080 
00082     void setInserter(UpwardEdgeInserterModule *pInserter) {
00083         m_inserter.set(pInserter);
00084     }   
00085     
00087     void setAcyclicSubgraphModule(AcyclicSubgraphModule *acyclicMod) {
00088         m_acyclicMod.set(acyclicMod);
00089     }
00090 
00091     int runs() {return m_runs;}
00092     void runs(int n) {m_runs = n;}
00093     
00094 protected:
00095 
00096     virtual ReturnType doCall(UpwardPlanRep &UPR,       
00097         const EdgeArray<int>  &cost,
00098         const EdgeArray<bool> &forbid);
00099 
00100     ModuleOption<FUPSModule> m_subgraph; 
00101     ModuleOption<UpwardEdgeInserterModule> m_inserter; 
00102     ModuleOption<AcyclicSubgraphModule> m_acyclicMod; 
00103     int m_runs; 
00104 
00105 private:
00106     
00107     void constructComponentGraphs(BCTree &BC, NodeArray<GraphCopy> &biComps);   
00108     
00110     void dfsMerge(const GraphCopy &GC,
00111              BCTree &BC, 
00112              NodeArray<GraphCopy> &biComps,                                     
00113              NodeArray<UpwardPlanRep> &uprs, 
00114              UpwardPlanRep &UPR_res,
00115              node parent_BC,
00116              node current_BC,
00117              NodeArray<bool> &nodesDone); 
00118     
00119 
00121     void merge(const GraphCopy &GC,      
00122          UpwardPlanRep &UPR_res,
00123          const GraphCopy &block,
00124          UpwardPlanRep &UPR             
00125          ); 
00126 };
00127 
00128 }
00129 
00130 #endif