Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047
00048 #ifndef OGDF_UPWARDPLANREP_H
00049 #define OGDF_UPWARDPLANREP_H
00050
00051
00052 #include <ogdf/basic/GraphCopy.h>
00053
00054 #include <iostream>
00055
00056
00057
00058
00059
00060 namespace ogdf {
00061
00062
00073 class OGDF_EXPORT UpwardPlanRep : public GraphCopy
00074 {
00075 public:
00076
00077 friend class SubgraphUpwardPlanarizer;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 UpwardPlanRep(const CombinatorialEmbedding &Gamma);
00089
00090 UpwardPlanRep(const GraphCopy &GC,
00091 adjEntry adj_ext);
00092
00094 UpwardPlanRep(const UpwardPlanRep &UPR);
00095
00097 UpwardPlanRep(): GraphCopy(), isAugmented(false), t_hat(0), s_hat(0), extFaceHandle(0), crossings(0)
00098 {
00099 m_Gamma.init(*this);
00100 m_isSinkArc.init(*this, false);
00101 m_isSourceArc.init(*this, false);
00102 }
00103
00104 virtual ~UpwardPlanRep() {}
00105
00107 void insertEdgePathEmbedded(
00108 edge eOrig,
00109 SList<adjEntry> crossedEdges,
00110 EdgeArray<int> &cost);
00111
00113
00114
00115
00116 void augment();
00117
00119 bool augmented() const { return isAugmented; }
00120
00122 const CombinatorialEmbedding & getEmbedding() const {return m_Gamma;}
00123
00124 CombinatorialEmbedding & getEmbedding() {return m_Gamma;}
00125
00126 node getSuperSink() const {return t_hat;}
00127
00128 node getSuperSource() const {return s_hat;}
00129
00130 int numberOfCrossings() const {return crossings;}
00131
00133 UpwardPlanRep &operator=(const UpwardPlanRep ©);
00134
00135 bool isSinkArc(edge e) const {return m_isSinkArc[e];}
00136
00137 bool isSourceArc(edge e) const {return m_isSourceArc[e];}
00138
00141 adjEntry sinkSwitchOf(node v) {return m_sinkSwitchOf[v];}
00142
00143
00144 adjEntry getAdjEntry(const CombinatorialEmbedding &Gamma, node v, face f) const {
00145 adjEntry adj;
00146 forall_adj(adj, v) {
00147 if (Gamma.rightFace(adj) == f)
00148 break;
00149 }
00150
00151 OGDF_ASSERT(Gamma.rightFace(adj) == f);
00152
00153 return adj;
00154 }
00155
00156
00157 adjEntry leftInEdge(node v) const
00158 {
00159 if (v->indeg() == 0)
00160 return 0;
00161 adjEntry adj;
00162 forall_adj(adj, v) {
00163 if (adj->theEdge()->target() == v && adj->cyclicSucc()->theEdge()->source() == v)
00164 break;
00165 }
00166 return adj;
00167 }
00168
00169
00170 void outputFaces (const CombinatorialEmbedding &embedding) const {
00171 cout << endl << "Face UPR " << endl;
00172 face f;
00173 forall_faces(f, embedding) {
00174 cout << "face " << f->index() << ": ";
00175 adjEntry adjNext = f->firstAdj();
00176 do {
00177 cout << adjNext->theEdge() << "; ";
00178 adjNext = adjNext->faceCycleSucc();
00179 } while(adjNext != f->firstAdj());
00180 cout << endl;
00181 }
00182 if (embedding.externalFace() != 0)
00183 cout << "ext. face of the graph is: " << embedding.externalFace()->index() << endl;
00184 else
00185 cout << "no ext. face set." << endl;
00186 }
00187
00188
00189
00190 protected:
00191
00192 bool isAugmented;
00193
00194 CombinatorialEmbedding m_Gamma;
00195
00196 node t_hat;
00197
00198 node s_hat;
00199
00200
00201
00202 EdgeArray<bool> m_isSinkArc;
00203
00204
00205 EdgeArray<bool> m_isSourceArc;
00206
00207
00208
00209 NodeArray<adjEntry> m_sinkSwitchOf;
00210
00211 adjEntry extFaceHandle;
00212
00213 int crossings;
00214
00215
00216 private:
00217 void computeSinkSwitches();
00218
00220 void initMe();
00221
00222 void copyMe(const UpwardPlanRep &UPR);
00223
00224 void removeSinkArcs(SList<adjEntry> &crossedEdges);
00225
00226 void constructSinkArcs(face f, node t);
00227
00228 };
00229
00230 }
00231
00232
00233 #endif