Open
Graph Drawing
Framework

 v.2012.05
 

VariableEmbeddingInserter2.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 
00048 #ifndef OGDF_VARIABLE_EMBEDDING_INSERTER_2_H
00049 #define OGDF_VARIABLE_EMBEDDING_INSERTER_2_H
00050 
00051 
00052 #include <ogdf/module/EdgeInsertionModule.h>
00053 
00054 
00055 namespace ogdf {
00056 
00057 class OGDF_EXPORT BCandSPQRtrees;
00058 class OGDF_EXPORT ExpandedGraph2;
00059 
00060 
00061 //---------------------------------------------------------
00062 // VariableEmbeddingInserter2
00063 // edge insertion module that inserts each edge optimally
00064 // into a given embedding.
00065 //---------------------------------------------------------
00066 class OGDF_EXPORT VariableEmbeddingInserter2 : public EdgeInsertionModule
00067 {
00068 public:
00069     // construction
00070     VariableEmbeddingInserter2();
00071     // destruction
00072     virtual ~VariableEmbeddingInserter2() { }
00073 
00074     //
00075     // options
00076     //
00077 
00078     // sets remove-reinsert option (postprocessing)
00079     // possible values: (see EdgeInsertionModule)
00080     //    rrNone, rrInserted, rrMostCrossed, rrAll
00081     void removeReinsert(RemoveReinsertType rrOption) {
00082         m_rrOption = rrOption;
00083     }
00084 
00085     // returns remove-reinsert option
00086     RemoveReinsertType removeReinsert() const {
00087         return m_rrOption;
00088     }
00089 
00090 
00091     // sets the portion of most crossed edges used if remove-reinsert option
00092     // is set to rrMostCrossed
00093     // this portion no. of edges * percentMostCrossed() / 100
00094     void percentMostCrossed(double percent) {
00095         m_percentMostCrossed = percent;
00096     }
00097 
00098     // returns option percentMostCrossed
00099     double percentMostCrossed() const {
00100         return m_percentMostCrossed;
00101     }
00102 
00103 
00104     // returns the number of runs performed by the postprocessing
00105     // after algoithm has been called
00106     int runsPostprocessing() const {
00107         return m_runsPostprocessing;
00108     }
00109 
00110 private:
00111     // performs actual call
00112     ReturnType doCall(
00113         PlanRep &PG,                     // planarized representation
00114         const List<edge> &origEdges,     // original edge to be inserted
00115         bool forbidCrossingGens,         // frobid crossings between gen's
00116         const EdgeArray<int> *costOrig,  // pointer to array of cost of original
00117                                          // edges; if pointer is 0 all costs are 1
00118         const EdgeArray<bool> *forbiddenEdgeOrig); // pointer to array deciding
00119                         // which original edges are forbidden to cross; if pointer
00120                         // is 0 no edges are explicitly forbidden to cross
00121 
00122     edge crossedEdge(adjEntry adj) const;
00123     int costCrossed(edge eOrig) const;
00124 
00125     bool                   m_forbidCrossingGens;
00126     const EdgeArray<int>  *m_costOrig;
00127     const EdgeArray<bool> *m_forbiddenEdgeOrig;
00128     Graph::EdgeType        m_typeOfCurrentEdge;
00129 
00130     void insert(edge eOrig, SList<adjEntry> &eip);
00131     void blockInsert(node s, node t, List<adjEntry> &L);
00132 
00133     PlanRep *m_pPG;
00134 
00135     BCandSPQRtrees *m_pBC;
00136 
00137     void buildSubpath(node v,
00138         node vPred,
00139         node vSucc,
00140         List<adjEntry> &L,
00141         ExpandedGraph2 &Exp,
00142         node s,
00143         node t);
00144     edge insertEdge(node v, node w, Graph &Exp,
00145         NodeArray<node> &GtoExp, List<node> &nodesG);
00146 
00147 
00148     // options
00149     RemoveReinsertType m_rrOption;
00150     double m_percentMostCrossed;
00151 
00152     // results
00153     int m_runsPostprocessing;
00154 
00155 }; // class VariableEmbeddingInserter2
00156 
00157 
00158 } // end namespace ogdf
00159 
00160 
00161 #endif