00001
00002
00003
00004
00005
00006
00007
00008
00050 #ifdef _MSC_VER
00051 #pragma once
00052 #endif
00053
00054 #ifndef OGDF_EXTENDED_GRAPH_ALG_H
00055 #define OGDF_EXTENDED_GRAPH_ALG_H
00056
00057
00058 #include <ogdf/cluster/ClusterGraph.h>
00059
00060 namespace ogdf {
00061
00062
00063
00064
00065
00066
00068 template<class LISTITERATOR>
00069 void inducedSubGraph(const Graph &G, LISTITERATOR start, Graph &subGraph)
00070 {
00071 NodeArray<node> nodeTableOrig2New;
00072 inducedSubGraph(G,start,subGraph,nodeTableOrig2New);
00073 }
00074
00076 template<class LISTITERATOR>
00077 void inducedSubGraph(const Graph &G,
00078 LISTITERATOR start,
00079 Graph &subGraph,
00080 NodeArray<node> &nodeTableOrig2New)
00081 {
00082 subGraph.clear();
00083 nodeTableOrig2New.init(G,0);
00084
00085 EdgeArray<bool> mark(G,false);
00086
00087 LISTITERATOR its;
00088 for (its = start; its.valid(); its++)
00089 {
00090 node w = (*its);
00091 OGDF_ASSERT(w != 0 && w->graphOf() == &G);
00092 nodeTableOrig2New[w] = subGraph.newNode();
00093
00094 adjEntry adj = w->firstAdj();
00095 forall_adj(adj,w)
00096 {
00097 edge e = adj->theEdge();
00098 if (nodeTableOrig2New[e->source()] && nodeTableOrig2New[e->target()] && !mark[e])
00099 {
00100 subGraph.newEdge(nodeTableOrig2New[e->source()],nodeTableOrig2New[e->target()]);
00101 mark[e] = true;
00102 }
00103 }
00104 }
00105 }
00106
00107
00109 template<class LISTITERATOR>
00110 void inducedSubGraph(const Graph &G,
00111 LISTITERATOR start,
00112 Graph &subGraph,
00113 NodeArray<node> &nodeTableOrig2New,
00114 EdgeArray<edge> &edgeTableOrig2New)
00115 {
00116 subGraph.clear();
00117 nodeTableOrig2New.init(G,0);
00118 edgeTableOrig2New.init(G,0);
00119
00120 EdgeArray<bool> mark(G,false);
00121
00122 LISTITERATOR its;
00123 for (its = start; its.valid(); its++)
00124 {
00125 node w = (*its);
00126 OGDF_ASSERT(w != 0 && w->graphOf() == &G);
00127 nodeTableOrig2New[w] = subGraph.newNode();
00128
00129 adjEntry adj = w->firstAdj();
00130 forall_adj(adj,w)
00131 {
00132 edge e = adj->theEdge();
00133 if (nodeTableOrig2New[e->source()] &&
00134 nodeTableOrig2New[e->target()] &&
00135 !mark[e])
00136 {
00137 edgeTableOrig2New[e] =
00138 subGraph.newEdge(
00139 nodeTableOrig2New[e->source()],
00140 nodeTableOrig2New[e->target()]);
00141 mark[e] = true;
00142 }
00143 }
00144 }
00145 }
00146
00147
00148 template<class NODELISTITERATOR,class EDGELIST>
00149 void inducedSubgraph(Graph &G,NODELISTITERATOR &it,EDGELIST &E)
00150 {
00151 NODELISTITERATOR itBegin = it;
00152 NodeArray<bool> mark(G,false);
00153
00154 for (;it.valid();it++)
00155 mark[(*it)] = true;
00156 it = itBegin;
00157 for (;it.valid();it++)
00158 {
00159 node v = (*it);
00160 adjEntry adj;
00161 forall_adj(adj,v)
00162 {
00163 edge e = adj->theEdge();
00164 if (mark[e->source()] && mark[e->target()])
00165 E.pushBack(e);
00166 }
00167 }
00168 }
00169
00170
00171
00172
00173
00174
00175
00176
00177 bool isCConnected(const ClusterGraph &C);
00178
00179
00180
00181
00182 void makeCConnected(ClusterGraph& C, Graph& GG, List<edge>& addedEdges,
00183 bool simple = true);
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 int stNumber(const Graph &G,
00203 NodeArray<int> &numbering,
00204 node s = 0,
00205 node t = 0,
00206 bool randomized = false);
00207
00208
00209
00210
00211 bool testSTnumber(const Graph &G, NodeArray<int> &st_no,int max);
00212
00213 }
00214
00215
00216 #endif