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