00001
00002
00003
00004
00005
00006
00007
00008
00045 #ifdef _MSC_VER
00046 #pragma once
00047 #endif
00048
00049 #ifndef OGDF_UPWARD_PLANAR_MODULE_H
00050 #define OGDF_UPWARD_PLANAR_MODULE_H
00051
00052
00053 #include <ogdf/basic/CombinatorialEmbedding.h>
00054 #include <ogdf/basic/NodeArray.h>
00055 #include <ogdf/basic/SList.h>
00056
00057
00058 namespace ogdf {
00059
00060 class OGDF_EXPORT SPQRTree;
00061 class OGDF_EXPORT Skeleton;
00062 class OGDF_EXPORT StaticPlanarSPQRTree;
00063 class OGDF_EXPORT ExpansionGraph;
00064 class OGDF_EXPORT FaceSinkGraph;
00065
00066
00067
00068
00069 class OGDF_EXPORT UpwardPlanarModule
00070 {
00071 public:
00072
00073 UpwardPlanarModule() { }
00074
00075
00076
00077
00078
00079
00080 bool upwardPlanarityTest(Graph &G) {
00081 NodeArray<SListPure<adjEntry> > adjacentEdges;
00082 return doUpwardPlanarityTest(G,false,adjacentEdges);
00083 }
00084
00085
00086
00087 bool upwardPlanarEmbed(Graph &G)
00088 {
00089 NodeArray<SListPure<adjEntry> > adjacentEdges(G);
00090 if(doUpwardPlanarityTest(G,true,adjacentEdges) == false)
00091 return false;
00092 SList<node> augmentedNodes;
00093 SList<edge> augmentedEdges;
00094 doUpwardPlanarityEmbed(G,adjacentEdges,false,augmentedNodes,augmentedEdges);
00095 return true;
00096 }
00097
00098
00099
00100 bool upwardPlanarAugment(Graph &G,
00101 SList<node> &augmentedNodes,
00102 SList<edge> &augmentedEdges)
00103 {
00104 NodeArray<SListPure<adjEntry> > adjacentEdges(G);
00105 if(doUpwardPlanarityTest(G,true,adjacentEdges) == false)
00106 return false;
00107 doUpwardPlanarityEmbed(G,adjacentEdges,true,augmentedNodes,augmentedEdges);
00108 return true;
00109 }
00110
00111
00112
00113 bool upwardPlanarAugment(Graph &G,
00114 node &superSink,
00115 SList<edge> &augmentedEdges)
00116 {
00117 NodeArray<SListPure<adjEntry> > adjacentEdges(G);
00118 if(doUpwardPlanarityTest(G,true,adjacentEdges) == false)
00119 return false;
00120 doUpwardPlanarityEmbed(G,adjacentEdges,true,superSink,augmentedEdges);
00121 return true;
00122 }
00123
00124
00125
00126 bool upwardPlanarAugment(Graph &G)
00127 {
00128 node superSink;
00129 SList<edge> augmentedEdges;
00130 return upwardPlanarAugment(G,superSink,augmentedEdges);
00131 }
00132
00133
00134
00135
00136
00137
00138
00139
00140 bool testEmbeddedBiconnected(
00141 const Graph &G,
00142 const ConstCombinatorialEmbedding &E,
00143 SList<face> &externalFaces);
00144
00145
00146
00147 bool testAndAugmentEmbedded(
00148 Graph &G,
00149 SList<node> &augmentedNodes,
00150 SList<edge> &augmentedEdges);
00151
00152 bool testAndAugmentEmbedded(
00153 Graph &G,
00154 node &superSink,
00155 SList<edge> &augmentedEdges);
00156
00157
00158 private:
00159
00160 struct DegreeInfo {
00161 int m_indegSrc;
00162 int m_outdegSrc;
00163 int m_indegTgt;
00164 int m_outdegTgt;
00165 };
00166
00167
00168 class OGDF_EXPORT SkeletonInfo;
00169 class ConstraintRooting;
00170
00171
00172
00173 node getSingleSource(const Graph &G);
00174
00175
00176
00177
00178
00179
00180 bool doUpwardPlanarityTest(
00181 Graph &G,
00182 bool embed,
00183 NodeArray<SListPure<adjEntry> > &adjacentEdges);
00184
00185
00186
00187 void doUpwardPlanarityEmbed(
00188 Graph &G,
00189 NodeArray<SListPure<adjEntry> > &adjacentEdges,
00190 bool augment,
00191 SList<node> &augmentedNodes,
00192 SList<edge> &augmentedEdges);
00193
00194
00195
00196 void doUpwardPlanarityEmbed(
00197 Graph &G,
00198 NodeArray<SListPure<adjEntry> > &adjacentEdges,
00199 bool augment,
00200 node &superSink,
00201 SList<edge> &augmentedEdges);
00202
00203
00204
00205 bool testBiconnectedComponent(
00206 ExpansionGraph &exp,
00207 node sG,
00208 int parentBlock,
00209 bool embed,
00210 NodeArray<SListPure<adjEntry> > &adjacentEdges);
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 edge directSkeletons(
00221 SPQRTree &T,
00222 NodeArray<SkeletonInfo> &skInfo);
00223
00224
00225
00226 void computeDegreesInPertinent(
00227 const SPQRTree &T,
00228 node s,
00229 NodeArray<SkeletonInfo> &skInfo,
00230 node vT);
00231
00232
00233
00234
00235
00236 bool initFaceSinkGraph(const Graph &M, SkeletonInfo &skInfo);
00237
00238 void embedSkeleton(
00239 Graph &G,
00240 StaticPlanarSPQRTree &T,
00241 NodeArray<SkeletonInfo> &skInfo,
00242 node vT,
00243 bool extFaceIsLeft);
00244
00245
00246
00247
00248
00249 void assignSinks(
00250 FaceSinkGraph &F,
00251 face extFace,
00252 NodeArray<face> &assignedFace);
00253
00254 node dfsAssignSinks(
00255 FaceSinkGraph &F,
00256 node v,
00257 node parent,
00258 NodeArray<face> &assignedFace);
00259
00260
00261
00262
00263
00264 bool checkDegrees(
00265 SPQRTree &T,
00266 node s,
00267 NodeArray<SkeletonInfo> &skInfo);
00268
00269 bool virtualEdgesDirectedEqually(const SPQRTree &T);
00270
00271
00272
00273 };
00274
00275
00276 }
00277
00278
00279 #endif