Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00052 #ifdef _MSC_VER
00053 #pragma once
00054 #endif
00055
00056 #ifndef OGDF_PLANAR_AUGMENTATION_H
00057 #define OGDF_PLANAR_AUGMENTATION_H
00058
00059 #include <ogdf/module/AugmentationModule.h>
00060 #include <ogdf/basic/List.h>
00061 #include <ogdf/decomposition/DynamicBCTree.h>
00062
00063 namespace ogdf {
00064
00065
00066 enum paStopCause {paPlanarity, paCDegree, paBDegree, paRoot};
00067
00068
00069 class PlanarAugmentation;
00070 class labelStruct;
00071
00072
00073 typedef labelStruct* label;
00074
00082 class labelStruct {
00083
00084 friend class OGDF_EXPORT PlanarAugmentation;
00085 friend class OGDF_EXPORT PlanarAugmentationFix;
00086
00087 private:
00088
00095 node m_parent;
00099 node m_head;
00103 List<node> m_pendants;
00108 paStopCause m_stopCause;
00109
00110 public:
00111 labelStruct(node parent, node cutvertex, paStopCause sc = paBDegree) {
00112 m_parent = parent;
00113 m_head = cutvertex;
00114 m_stopCause = sc;
00115 };
00116
00117 bool isBLabel() {
00118 return (m_parent != 0);
00119 };
00120
00121 bool isCLabel() {
00122 return (m_parent == 0);
00123 };
00124
00126 node getPendant(int nr) {
00127 return (nr < m_pendants.size()) ? (*(m_pendants.get(nr))) : 0;
00128 };
00129
00130 node getFirstPendant() {
00131 return (m_pendants.size() > 0) ? m_pendants.front() : 0;
00132 };
00133
00134 node getLastPendant() {
00135 return (m_pendants.size() > 0) ? m_pendants.back() : 0;
00136 };
00137
00139 int size() {
00140 return m_pendants.size();
00141 };
00142
00143 void removePendant(node pendant);
00144
00145 void removePendant(ListIterator<node> it){
00146 m_pendants.del(it);
00147 };
00148
00149 void removeFirstPendant() {
00150 if (m_pendants.size() > 0){
00151 m_pendants.popFront();
00152 }
00153 };
00154
00155 void addPendant(node pendant) {
00156 m_pendants.pushBack(pendant);
00157 };
00158
00159 void deleteAllPendants() {
00160 m_pendants.clear();
00161 };
00162
00164 node parent() {
00165 return (m_parent != 0) ? m_parent : m_head;
00166 };
00167
00169 node head() {
00170 return m_head;
00171 };
00172
00173 void setParent(node newParent){
00174 m_parent = newParent;
00175 }
00176
00177 void setHead(node newHead){
00178 m_head = newHead;
00179 }
00180
00181 paStopCause stopCause(){
00182 return m_stopCause;
00183 }
00184
00185 void stopCause(paStopCause sc){
00186 m_stopCause = sc;
00187 }
00188
00189 OGDF_NEW_DELETE
00190 };
00191
00192
00193
00210 class OGDF_EXPORT PlanarAugmentation : public AugmentationModule {
00211
00212 public:
00214 PlanarAugmentation() { }
00215
00216 ~PlanarAugmentation() { }
00217
00218 protected:
00225 void doCall(Graph& G, List<edge>& L);
00226
00227
00228 private:
00232 int m_nPlanarityTests;
00233
00237 Graph* m_pGraph;
00241 DynamicBCTree* m_pBCTree;
00242
00246 List<edge>* m_pResult;
00247
00251 List<label> m_labels;
00255 List<node> m_pendants;
00256
00260 List<node> m_pendantsToDel;
00261
00265 NodeArray<label> m_belongsTo;
00269 NodeArray< ListIterator<label> > m_isLabel;
00270
00278 NodeArray< SList<adjEntry> > m_adjNonChildren;
00279
00280
00281 private:
00282
00286 void augment();
00287
00292 void makeConnectedByPendants();
00293
00301 void reduceChain(node p, label labelOld = 0);
00302
00312 paStopCause followPath(node v, node& last);
00313
00320 bool planarityCheck(node v1, node v2);
00321
00329 node adjToCutvertex(node v, node cutvertex = 0);
00330
00335 node findLastBefore(node pendant, node ancestor);
00336
00341 void deletePendant(node p, bool removeFromLabel = true);
00345 void addPendant(node p, label& l);
00346
00352 edge connectPendants(node pendant1, node pendant2);
00356 void removeAllPendants(label& l);
00357
00361 void joinPendants(label& l);
00362
00366 void connectInsideLabel(label& l);
00367
00373 ListIterator<label> insertLabel(label l);
00374
00378 void deleteLabel(label& l, bool removePendants = true);
00379
00384 void connectLabels(label first, label second);
00385
00389 label newLabel(node cutvertex, node p, paStopCause whyStop);
00390
00400 bool findMatching(label& first, label& second);
00401
00406 bool connectCondition(label a, label b);
00407
00414 void updateAdjNonChildren(node newBlock, SList<node>& path);
00415
00419 void modifyBCRoot(node oldRoot, node newRoot);
00420
00426 void updateNewEdges(const SList<edge> &newEdges);
00427
00431 void terminate();
00432
00433 };
00434
00435
00436 }
00437
00438 #endif