deba@414
|
1 |
/* -*- C++ -*-
|
deba@414
|
2 |
*
|
deba@414
|
3 |
* This file is a part of LEMON, a generic C++ optimization library
|
deba@414
|
4 |
*
|
deba@414
|
5 |
* Copyright (C) 2003-2008
|
deba@414
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
deba@414
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
deba@414
|
8 |
*
|
deba@414
|
9 |
* Permission to use, modify and distribute this software is granted
|
deba@414
|
10 |
* provided that this copyright notice appears in all copies. For
|
deba@414
|
11 |
* precise terms see the accompanying LICENSE file.
|
deba@414
|
12 |
*
|
deba@414
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
deba@414
|
14 |
* express or implied, and with no claim as to its suitability for any
|
deba@414
|
15 |
* purpose.
|
deba@414
|
16 |
*
|
deba@414
|
17 |
*/
|
deba@414
|
18 |
|
deba@414
|
19 |
#ifndef LEMON_GRAPH_ADAPTOR_H
|
deba@414
|
20 |
#define LEMON_GRAPH_ADAPTOR_H
|
deba@414
|
21 |
|
deba@414
|
22 |
///\ingroup graph_adaptors
|
deba@414
|
23 |
///\file
|
deba@414
|
24 |
///\brief Several graph adaptors.
|
deba@414
|
25 |
///
|
deba@414
|
26 |
///This file contains several useful undirected graph adaptor classes.
|
deba@414
|
27 |
|
deba@414
|
28 |
#include <lemon/core.h>
|
deba@414
|
29 |
#include <lemon/maps.h>
|
deba@414
|
30 |
#include <lemon/bits/graph_adaptor_extender.h>
|
deba@414
|
31 |
|
deba@414
|
32 |
namespace lemon {
|
deba@414
|
33 |
|
deba@414
|
34 |
/// \brief Base type for the Graph Adaptors
|
deba@414
|
35 |
///
|
deba@414
|
36 |
/// This is the base type for most of LEMON graph adaptors.
|
deba@414
|
37 |
/// This class implements a trivial graph adaptor i.e. it only wraps the
|
deba@414
|
38 |
/// functions and types of the graph. The purpose of this class is to
|
deba@414
|
39 |
/// make easier implementing graph adaptors. E.g. if an adaptor is
|
deba@414
|
40 |
/// considered which differs from the wrapped graph only in some of its
|
deba@414
|
41 |
/// functions or types, then it can be derived from GraphAdaptor, and only
|
deba@414
|
42 |
/// the differences should be implemented.
|
deba@414
|
43 |
template<typename _Graph>
|
deba@414
|
44 |
class GraphAdaptorBase {
|
deba@414
|
45 |
public:
|
deba@414
|
46 |
typedef _Graph Graph;
|
deba@414
|
47 |
typedef Graph ParentGraph;
|
deba@414
|
48 |
|
deba@414
|
49 |
protected:
|
deba@414
|
50 |
Graph* _graph;
|
deba@414
|
51 |
|
deba@414
|
52 |
GraphAdaptorBase() : _graph(0) {}
|
deba@414
|
53 |
|
deba@414
|
54 |
void setGraph(Graph& graph) { _graph = &graph; }
|
deba@414
|
55 |
|
deba@414
|
56 |
public:
|
deba@414
|
57 |
GraphAdaptorBase(Graph& graph) : _graph(&graph) {}
|
deba@414
|
58 |
|
deba@414
|
59 |
typedef typename Graph::Node Node;
|
deba@414
|
60 |
typedef typename Graph::Arc Arc;
|
deba@414
|
61 |
typedef typename Graph::Edge Edge;
|
deba@414
|
62 |
|
deba@414
|
63 |
void first(Node& i) const { _graph->first(i); }
|
deba@414
|
64 |
void first(Arc& i) const { _graph->first(i); }
|
deba@414
|
65 |
void first(Edge& i) const { _graph->first(i); }
|
deba@414
|
66 |
void firstIn(Arc& i, const Node& n) const { _graph->firstIn(i, n); }
|
deba@414
|
67 |
void firstOut(Arc& i, const Node& n ) const { _graph->firstOut(i, n); }
|
deba@414
|
68 |
void firstInc(Edge &i, bool &d, const Node &n) const {
|
deba@414
|
69 |
_graph->firstInc(i, d, n);
|
deba@414
|
70 |
}
|
deba@414
|
71 |
|
deba@414
|
72 |
void next(Node& i) const { _graph->next(i); }
|
deba@414
|
73 |
void next(Arc& i) const { _graph->next(i); }
|
deba@414
|
74 |
void next(Edge& i) const { _graph->next(i); }
|
deba@414
|
75 |
void nextIn(Arc& i) const { _graph->nextIn(i); }
|
deba@414
|
76 |
void nextOut(Arc& i) const { _graph->nextOut(i); }
|
deba@414
|
77 |
void nextInc(Edge &i, bool &d) const { _graph->nextInc(i, d); }
|
deba@414
|
78 |
|
deba@414
|
79 |
Node u(const Edge& e) const { return _graph->u(e); }
|
deba@414
|
80 |
Node v(const Edge& e) const { return _graph->v(e); }
|
deba@414
|
81 |
|
deba@414
|
82 |
Node source(const Arc& a) const { return _graph->source(a); }
|
deba@414
|
83 |
Node target(const Arc& a) const { return _graph->target(a); }
|
deba@414
|
84 |
|
deba@414
|
85 |
typedef NodeNumTagIndicator<Graph> NodeNumTag;
|
deba@414
|
86 |
int nodeNum() const { return _graph->nodeNum(); }
|
deba@414
|
87 |
|
deba@414
|
88 |
typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
|
deba@414
|
89 |
int arcNum() const { return _graph->arcNum(); }
|
deba@414
|
90 |
int edgeNum() const { return _graph->edgeNum(); }
|
deba@414
|
91 |
|
deba@414
|
92 |
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
|
deba@414
|
93 |
Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
|
deba@414
|
94 |
return _graph->findArc(u, v, prev);
|
deba@414
|
95 |
}
|
deba@414
|
96 |
Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) {
|
deba@414
|
97 |
return _graph->findEdge(u, v, prev);
|
deba@414
|
98 |
}
|
deba@414
|
99 |
|
deba@414
|
100 |
Node addNode() { return _graph->addNode(); }
|
deba@414
|
101 |
Edge addEdge(const Node& u, const Node& v) { return _graph->addEdge(u, v); }
|
deba@414
|
102 |
|
deba@414
|
103 |
void erase(const Node& i) { _graph->erase(i); }
|
deba@414
|
104 |
void erase(const Edge& i) { _graph->erase(i); }
|
deba@414
|
105 |
|
deba@414
|
106 |
void clear() { _graph->clear(); }
|
deba@414
|
107 |
|
deba@414
|
108 |
bool direction(const Arc& a) const { return _graph->direction(a); }
|
deba@414
|
109 |
Arc direct(const Edge& e, bool d) const { return _graph->direct(e, d); }
|
deba@414
|
110 |
|
deba@414
|
111 |
int id(const Node& v) const { return _graph->id(v); }
|
deba@414
|
112 |
int id(const Arc& a) const { return _graph->id(a); }
|
deba@414
|
113 |
int id(const Edge& e) const { return _graph->id(e); }
|
deba@414
|
114 |
|
deba@414
|
115 |
Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
|
deba@414
|
116 |
Arc arcFromId(int ix) const { return _graph->arcFromId(ix); }
|
deba@414
|
117 |
Edge edgeFromId(int ix) const { return _graph->edgeFromId(ix); }
|
deba@414
|
118 |
|
deba@414
|
119 |
int maxNodeId() const { return _graph->maxNodeId(); }
|
deba@414
|
120 |
int maxArcId() const { return _graph->maxArcId(); }
|
deba@414
|
121 |
int maxEdgeId() const { return _graph->maxEdgeId(); }
|
deba@414
|
122 |
|
deba@414
|
123 |
typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
|
deba@414
|
124 |
NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
|
deba@414
|
125 |
|
deba@414
|
126 |
typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
|
deba@414
|
127 |
ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
|
deba@414
|
128 |
|
deba@414
|
129 |
typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier;
|
deba@414
|
130 |
EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); }
|
deba@414
|
131 |
|
deba@414
|
132 |
template <typename _Value>
|
deba@414
|
133 |
class NodeMap : public Graph::template NodeMap<_Value> {
|
deba@414
|
134 |
public:
|
deba@414
|
135 |
typedef typename Graph::template NodeMap<_Value> Parent;
|
deba@414
|
136 |
explicit NodeMap(const GraphAdaptorBase<Graph>& adapter)
|
deba@414
|
137 |
: Parent(*adapter._graph) {}
|
deba@414
|
138 |
NodeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
|
deba@414
|
139 |
: Parent(*adapter._graph, value) {}
|
deba@414
|
140 |
|
deba@414
|
141 |
private:
|
deba@414
|
142 |
NodeMap& operator=(const NodeMap& cmap) {
|
deba@414
|
143 |
return operator=<NodeMap>(cmap);
|
deba@414
|
144 |
}
|
deba@414
|
145 |
|
deba@414
|
146 |
template <typename CMap>
|
deba@414
|
147 |
NodeMap& operator=(const CMap& cmap) {
|
deba@414
|
148 |
Parent::operator=(cmap);
|
deba@414
|
149 |
return *this;
|
deba@414
|
150 |
}
|
deba@414
|
151 |
|
deba@414
|
152 |
};
|
deba@414
|
153 |
|
deba@414
|
154 |
template <typename _Value>
|
deba@414
|
155 |
class ArcMap : public Graph::template ArcMap<_Value> {
|
deba@414
|
156 |
public:
|
deba@414
|
157 |
typedef typename Graph::template ArcMap<_Value> Parent;
|
deba@414
|
158 |
explicit ArcMap(const GraphAdaptorBase<Graph>& adapter)
|
deba@414
|
159 |
: Parent(*adapter._graph) {}
|
deba@414
|
160 |
ArcMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
|
deba@414
|
161 |
: Parent(*adapter._graph, value) {}
|
deba@414
|
162 |
|
deba@414
|
163 |
private:
|
deba@414
|
164 |
ArcMap& operator=(const ArcMap& cmap) {
|
deba@414
|
165 |
return operator=<ArcMap>(cmap);
|
deba@414
|
166 |
}
|
deba@414
|
167 |
|
deba@414
|
168 |
template <typename CMap>
|
deba@414
|
169 |
ArcMap& operator=(const CMap& cmap) {
|
deba@414
|
170 |
Parent::operator=(cmap);
|
deba@414
|
171 |
return *this;
|
deba@414
|
172 |
}
|
deba@414
|
173 |
};
|
deba@414
|
174 |
|
deba@414
|
175 |
template <typename _Value>
|
deba@414
|
176 |
class EdgeMap : public Graph::template EdgeMap<_Value> {
|
deba@414
|
177 |
public:
|
deba@414
|
178 |
typedef typename Graph::template EdgeMap<_Value> Parent;
|
deba@414
|
179 |
explicit EdgeMap(const GraphAdaptorBase<Graph>& adapter)
|
deba@414
|
180 |
: Parent(*adapter._graph) {}
|
deba@414
|
181 |
EdgeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
|
deba@414
|
182 |
: Parent(*adapter._graph, value) {}
|
deba@414
|
183 |
|
deba@414
|
184 |
private:
|
deba@414
|
185 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
deba@414
|
186 |
return operator=<EdgeMap>(cmap);
|
deba@414
|
187 |
}
|
deba@414
|
188 |
|
deba@414
|
189 |
template <typename CMap>
|
deba@414
|
190 |
EdgeMap& operator=(const CMap& cmap) {
|
deba@414
|
191 |
Parent::operator=(cmap);
|
deba@414
|
192 |
return *this;
|
deba@414
|
193 |
}
|
deba@414
|
194 |
};
|
deba@414
|
195 |
|
deba@414
|
196 |
};
|
deba@414
|
197 |
|
deba@414
|
198 |
/// \ingroup graph_adaptors
|
deba@414
|
199 |
///
|
deba@414
|
200 |
/// \brief Trivial graph adaptor
|
deba@414
|
201 |
///
|
deba@414
|
202 |
/// This class is an adaptor which does not change the adapted undirected
|
deba@414
|
203 |
/// graph. It can be used only to test the graph adaptors.
|
deba@414
|
204 |
template <typename _Graph>
|
deba@414
|
205 |
class GraphAdaptor
|
deba@414
|
206 |
: public GraphAdaptorExtender< GraphAdaptorBase<_Graph> > {
|
deba@414
|
207 |
public:
|
deba@414
|
208 |
typedef _Graph Graph;
|
deba@414
|
209 |
typedef GraphAdaptorExtender<GraphAdaptorBase<_Graph> > Parent;
|
deba@414
|
210 |
protected:
|
deba@414
|
211 |
GraphAdaptor() : Parent() {}
|
deba@414
|
212 |
|
deba@414
|
213 |
public:
|
deba@414
|
214 |
explicit GraphAdaptor(Graph& graph) { setGraph(graph); }
|
deba@414
|
215 |
};
|
deba@414
|
216 |
|
deba@414
|
217 |
template <typename _Graph, typename NodeFilterMap,
|
deba@414
|
218 |
typename EdgeFilterMap, bool checked = true>
|
deba@414
|
219 |
class SubGraphAdaptorBase : public GraphAdaptorBase<_Graph> {
|
deba@414
|
220 |
public:
|
deba@414
|
221 |
typedef _Graph Graph;
|
deba@414
|
222 |
typedef SubGraphAdaptorBase Adaptor;
|
deba@414
|
223 |
typedef GraphAdaptorBase<_Graph> Parent;
|
deba@414
|
224 |
protected:
|
deba@414
|
225 |
|
deba@414
|
226 |
NodeFilterMap* _node_filter_map;
|
deba@414
|
227 |
EdgeFilterMap* _edge_filter_map;
|
deba@414
|
228 |
|
deba@414
|
229 |
SubGraphAdaptorBase()
|
deba@414
|
230 |
: Parent(), _node_filter_map(0), _edge_filter_map(0) { }
|
deba@414
|
231 |
|
deba@414
|
232 |
void setNodeFilterMap(NodeFilterMap& node_filter_map) {
|
deba@414
|
233 |
_node_filter_map=&node_filter_map;
|
deba@414
|
234 |
}
|
deba@414
|
235 |
void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
|
deba@414
|
236 |
_edge_filter_map=&edge_filter_map;
|
deba@414
|
237 |
}
|
deba@414
|
238 |
|
deba@414
|
239 |
public:
|
deba@414
|
240 |
|
deba@414
|
241 |
typedef typename Parent::Node Node;
|
deba@414
|
242 |
typedef typename Parent::Arc Arc;
|
deba@414
|
243 |
typedef typename Parent::Edge Edge;
|
deba@414
|
244 |
|
deba@414
|
245 |
void first(Node& i) const {
|
deba@414
|
246 |
Parent::first(i);
|
deba@414
|
247 |
while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
|
deba@414
|
248 |
}
|
deba@414
|
249 |
|
deba@414
|
250 |
void first(Arc& i) const {
|
deba@414
|
251 |
Parent::first(i);
|
deba@414
|
252 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
253 |
|| !(*_node_filter_map)[Parent::source(i)]
|
deba@414
|
254 |
|| !(*_node_filter_map)[Parent::target(i)])) Parent::next(i);
|
deba@414
|
255 |
}
|
deba@414
|
256 |
|
deba@414
|
257 |
void first(Edge& i) const {
|
deba@414
|
258 |
Parent::first(i);
|
deba@414
|
259 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
260 |
|| !(*_node_filter_map)[Parent::u(i)]
|
deba@414
|
261 |
|| !(*_node_filter_map)[Parent::v(i)])) Parent::next(i);
|
deba@414
|
262 |
}
|
deba@414
|
263 |
|
deba@414
|
264 |
void firstIn(Arc& i, const Node& n) const {
|
deba@414
|
265 |
Parent::firstIn(i, n);
|
deba@414
|
266 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
267 |
|| !(*_node_filter_map)[Parent::source(i)])) Parent::nextIn(i);
|
deba@414
|
268 |
}
|
deba@414
|
269 |
|
deba@414
|
270 |
void firstOut(Arc& i, const Node& n) const {
|
deba@414
|
271 |
Parent::firstOut(i, n);
|
deba@414
|
272 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
273 |
|| !(*_node_filter_map)[Parent::target(i)])) Parent::nextOut(i);
|
deba@414
|
274 |
}
|
deba@414
|
275 |
|
deba@414
|
276 |
void firstInc(Edge& i, bool& d, const Node& n) const {
|
deba@414
|
277 |
Parent::firstInc(i, d, n);
|
deba@414
|
278 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
279 |
|| !(*_node_filter_map)[Parent::u(i)]
|
deba@414
|
280 |
|| !(*_node_filter_map)[Parent::v(i)])) Parent::nextInc(i, d);
|
deba@414
|
281 |
}
|
deba@414
|
282 |
|
deba@414
|
283 |
void next(Node& i) const {
|
deba@414
|
284 |
Parent::next(i);
|
deba@414
|
285 |
while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
|
deba@414
|
286 |
}
|
deba@414
|
287 |
|
deba@414
|
288 |
void next(Arc& i) const {
|
deba@414
|
289 |
Parent::next(i);
|
deba@414
|
290 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
291 |
|| !(*_node_filter_map)[Parent::source(i)]
|
deba@414
|
292 |
|| !(*_node_filter_map)[Parent::target(i)])) Parent::next(i);
|
deba@414
|
293 |
}
|
deba@414
|
294 |
|
deba@414
|
295 |
void next(Edge& i) const {
|
deba@414
|
296 |
Parent::next(i);
|
deba@414
|
297 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
298 |
|| !(*_node_filter_map)[Parent::u(i)]
|
deba@414
|
299 |
|| !(*_node_filter_map)[Parent::v(i)])) Parent::next(i);
|
deba@414
|
300 |
}
|
deba@414
|
301 |
|
deba@414
|
302 |
void nextIn(Arc& i) const {
|
deba@414
|
303 |
Parent::nextIn(i);
|
deba@414
|
304 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
305 |
|| !(*_node_filter_map)[Parent::source(i)])) Parent::nextIn(i);
|
deba@414
|
306 |
}
|
deba@414
|
307 |
|
deba@414
|
308 |
void nextOut(Arc& i) const {
|
deba@414
|
309 |
Parent::nextOut(i);
|
deba@414
|
310 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
311 |
|| !(*_node_filter_map)[Parent::target(i)])) Parent::nextOut(i);
|
deba@414
|
312 |
}
|
deba@414
|
313 |
|
deba@414
|
314 |
void nextInc(Edge& i, bool& d) const {
|
deba@414
|
315 |
Parent::nextInc(i, d);
|
deba@414
|
316 |
while (i!=INVALID && (!(*_edge_filter_map)[i]
|
deba@414
|
317 |
|| !(*_node_filter_map)[Parent::u(i)]
|
deba@414
|
318 |
|| !(*_node_filter_map)[Parent::v(i)])) Parent::nextInc(i, d);
|
deba@414
|
319 |
}
|
deba@414
|
320 |
|
deba@414
|
321 |
/// \brief Hide the given node in the graph.
|
deba@414
|
322 |
///
|
deba@414
|
323 |
/// This function hides \c n in the graph, i.e. the iteration
|
deba@414
|
324 |
/// jumps over it. This is done by simply setting the value of \c n
|
deba@414
|
325 |
/// to be false in the corresponding node-map.
|
deba@414
|
326 |
void hide(const Node& n) const { _node_filter_map->set(n, false); }
|
deba@414
|
327 |
|
deba@414
|
328 |
/// \brief Hide the given edge in the graph.
|
deba@414
|
329 |
///
|
deba@414
|
330 |
/// This function hides \c e in the graph, i.e. the iteration
|
deba@414
|
331 |
/// jumps over it. This is done by simply setting the value of \c e
|
deba@414
|
332 |
/// to be false in the corresponding edge-map.
|
deba@414
|
333 |
void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
|
deba@414
|
334 |
|
deba@414
|
335 |
/// \brief Unhide the given node in the graph.
|
deba@414
|
336 |
///
|
deba@414
|
337 |
/// The value of \c n is set to be true in the node-map which stores
|
deba@414
|
338 |
/// hide information. If \c n was hidden previuosly, then it is shown
|
deba@414
|
339 |
/// again
|
deba@414
|
340 |
void unHide(const Node& n) const { _node_filter_map->set(n, true); }
|
deba@414
|
341 |
|
deba@414
|
342 |
/// \brief Hide the given edge in the graph.
|
deba@414
|
343 |
///
|
deba@414
|
344 |
/// The value of \c e is set to be true in the edge-map which stores
|
deba@414
|
345 |
/// hide information. If \c e was hidden previuosly, then it is shown
|
deba@414
|
346 |
/// again
|
deba@414
|
347 |
void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
|
deba@414
|
348 |
|
deba@414
|
349 |
/// \brief Returns true if \c n is hidden.
|
deba@414
|
350 |
///
|
deba@414
|
351 |
/// Returns true if \c n is hidden.
|
deba@414
|
352 |
bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
|
deba@414
|
353 |
|
deba@414
|
354 |
/// \brief Returns true if \c e is hidden.
|
deba@414
|
355 |
///
|
deba@414
|
356 |
/// Returns true if \c e is hidden.
|
deba@414
|
357 |
bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
|
deba@414
|
358 |
|
deba@414
|
359 |
typedef False NodeNumTag;
|
deba@414
|
360 |
typedef False EdgeNumTag;
|
deba@414
|
361 |
|
deba@414
|
362 |
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
|
deba@414
|
363 |
Arc findArc(const Node& u, const Node& v,
|
deba@414
|
364 |
const Arc& prev = INVALID) {
|
deba@414
|
365 |
if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
|
deba@414
|
366 |
return INVALID;
|
deba@414
|
367 |
}
|
deba@414
|
368 |
Arc arc = Parent::findArc(u, v, prev);
|
deba@414
|
369 |
while (arc != INVALID && !(*_edge_filter_map)[arc]) {
|
deba@414
|
370 |
arc = Parent::findArc(u, v, arc);
|
deba@414
|
371 |
}
|
deba@414
|
372 |
return arc;
|
deba@414
|
373 |
}
|
deba@414
|
374 |
Edge findEdge(const Node& u, const Node& v,
|
deba@414
|
375 |
const Edge& prev = INVALID) {
|
deba@414
|
376 |
if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
|
deba@414
|
377 |
return INVALID;
|
deba@414
|
378 |
}
|
deba@414
|
379 |
Edge edge = Parent::findEdge(u, v, prev);
|
deba@414
|
380 |
while (edge != INVALID && !(*_edge_filter_map)[edge]) {
|
deba@414
|
381 |
edge = Parent::findEdge(u, v, edge);
|
deba@414
|
382 |
}
|
deba@414
|
383 |
return edge;
|
deba@414
|
384 |
}
|
deba@414
|
385 |
|
deba@414
|
386 |
template <typename _Value>
|
deba@414
|
387 |
class NodeMap : public SubMapExtender<Adaptor,
|
deba@414
|
388 |
typename Parent::template NodeMap<_Value> > {
|
deba@414
|
389 |
public:
|
deba@414
|
390 |
typedef _Value Value;
|
deba@414
|
391 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
392 |
template NodeMap<Value> > MapParent;
|
deba@414
|
393 |
|
deba@414
|
394 |
NodeMap(const Adaptor& adaptor)
|
deba@414
|
395 |
: MapParent(adaptor) {}
|
deba@414
|
396 |
NodeMap(const Adaptor& adaptor, const Value& value)
|
deba@414
|
397 |
: MapParent(adaptor, value) {}
|
deba@414
|
398 |
|
deba@414
|
399 |
private:
|
deba@414
|
400 |
NodeMap& operator=(const NodeMap& cmap) {
|
deba@414
|
401 |
return operator=<NodeMap>(cmap);
|
deba@414
|
402 |
}
|
deba@414
|
403 |
|
deba@414
|
404 |
template <typename CMap>
|
deba@414
|
405 |
NodeMap& operator=(const CMap& cmap) {
|
deba@414
|
406 |
MapParent::operator=(cmap);
|
deba@414
|
407 |
return *this;
|
deba@414
|
408 |
}
|
deba@414
|
409 |
};
|
deba@414
|
410 |
|
deba@414
|
411 |
template <typename _Value>
|
deba@414
|
412 |
class ArcMap : public SubMapExtender<Adaptor,
|
deba@414
|
413 |
typename Parent::template ArcMap<_Value> > {
|
deba@414
|
414 |
public:
|
deba@414
|
415 |
typedef _Value Value;
|
deba@414
|
416 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
417 |
template ArcMap<Value> > MapParent;
|
deba@414
|
418 |
|
deba@414
|
419 |
ArcMap(const Adaptor& adaptor)
|
deba@414
|
420 |
: MapParent(adaptor) {}
|
deba@414
|
421 |
ArcMap(const Adaptor& adaptor, const Value& value)
|
deba@414
|
422 |
: MapParent(adaptor, value) {}
|
deba@414
|
423 |
|
deba@414
|
424 |
private:
|
deba@414
|
425 |
ArcMap& operator=(const ArcMap& cmap) {
|
deba@414
|
426 |
return operator=<ArcMap>(cmap);
|
deba@414
|
427 |
}
|
deba@414
|
428 |
|
deba@414
|
429 |
template <typename CMap>
|
deba@414
|
430 |
ArcMap& operator=(const CMap& cmap) {
|
deba@414
|
431 |
MapParent::operator=(cmap);
|
deba@414
|
432 |
return *this;
|
deba@414
|
433 |
}
|
deba@414
|
434 |
};
|
deba@414
|
435 |
|
deba@414
|
436 |
template <typename _Value>
|
deba@414
|
437 |
class EdgeMap : public SubMapExtender<Adaptor,
|
deba@414
|
438 |
typename Parent::template EdgeMap<_Value> > {
|
deba@414
|
439 |
public:
|
deba@414
|
440 |
typedef _Value Value;
|
deba@414
|
441 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
442 |
template EdgeMap<Value> > MapParent;
|
deba@414
|
443 |
|
deba@414
|
444 |
EdgeMap(const Adaptor& adaptor)
|
deba@414
|
445 |
: MapParent(adaptor) {}
|
deba@414
|
446 |
|
deba@414
|
447 |
EdgeMap(const Adaptor& adaptor, const Value& value)
|
deba@414
|
448 |
: MapParent(adaptor, value) {}
|
deba@414
|
449 |
|
deba@414
|
450 |
private:
|
deba@414
|
451 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
deba@414
|
452 |
return operator=<EdgeMap>(cmap);
|
deba@414
|
453 |
}
|
deba@414
|
454 |
|
deba@414
|
455 |
template <typename CMap>
|
deba@414
|
456 |
EdgeMap& operator=(const CMap& cmap) {
|
deba@414
|
457 |
MapParent::operator=(cmap);
|
deba@414
|
458 |
return *this;
|
deba@414
|
459 |
}
|
deba@414
|
460 |
};
|
deba@414
|
461 |
|
deba@414
|
462 |
};
|
deba@414
|
463 |
|
deba@414
|
464 |
template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
|
deba@414
|
465 |
class SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, false>
|
deba@414
|
466 |
: public GraphAdaptorBase<_Graph> {
|
deba@414
|
467 |
public:
|
deba@414
|
468 |
typedef _Graph Graph;
|
deba@414
|
469 |
typedef SubGraphAdaptorBase Adaptor;
|
deba@414
|
470 |
typedef GraphAdaptorBase<_Graph> Parent;
|
deba@414
|
471 |
protected:
|
deba@414
|
472 |
NodeFilterMap* _node_filter_map;
|
deba@414
|
473 |
EdgeFilterMap* _edge_filter_map;
|
deba@414
|
474 |
SubGraphAdaptorBase() : Parent(),
|
deba@414
|
475 |
_node_filter_map(0), _edge_filter_map(0) { }
|
deba@414
|
476 |
|
deba@414
|
477 |
void setNodeFilterMap(NodeFilterMap& node_filter_map) {
|
deba@414
|
478 |
_node_filter_map=&node_filter_map;
|
deba@414
|
479 |
}
|
deba@414
|
480 |
void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
|
deba@414
|
481 |
_edge_filter_map=&edge_filter_map;
|
deba@414
|
482 |
}
|
deba@414
|
483 |
|
deba@414
|
484 |
public:
|
deba@414
|
485 |
|
deba@414
|
486 |
typedef typename Parent::Node Node;
|
deba@414
|
487 |
typedef typename Parent::Arc Arc;
|
deba@414
|
488 |
typedef typename Parent::Edge Edge;
|
deba@414
|
489 |
|
deba@414
|
490 |
void first(Node& i) const {
|
deba@414
|
491 |
Parent::first(i);
|
deba@414
|
492 |
while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
|
deba@414
|
493 |
}
|
deba@414
|
494 |
|
deba@414
|
495 |
void first(Arc& i) const {
|
deba@414
|
496 |
Parent::first(i);
|
deba@414
|
497 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
|
deba@414
|
498 |
}
|
deba@414
|
499 |
|
deba@414
|
500 |
void first(Edge& i) const {
|
deba@414
|
501 |
Parent::first(i);
|
deba@414
|
502 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
|
deba@414
|
503 |
}
|
deba@414
|
504 |
|
deba@414
|
505 |
void firstIn(Arc& i, const Node& n) const {
|
deba@414
|
506 |
Parent::firstIn(i, n);
|
deba@414
|
507 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i);
|
deba@414
|
508 |
}
|
deba@414
|
509 |
|
deba@414
|
510 |
void firstOut(Arc& i, const Node& n) const {
|
deba@414
|
511 |
Parent::firstOut(i, n);
|
deba@414
|
512 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i);
|
deba@414
|
513 |
}
|
deba@414
|
514 |
|
deba@414
|
515 |
void firstInc(Edge& i, bool& d, const Node& n) const {
|
deba@414
|
516 |
Parent::firstInc(i, d, n);
|
deba@414
|
517 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
|
deba@414
|
518 |
}
|
deba@414
|
519 |
|
deba@414
|
520 |
void next(Node& i) const {
|
deba@414
|
521 |
Parent::next(i);
|
deba@414
|
522 |
while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
|
deba@414
|
523 |
}
|
deba@414
|
524 |
void next(Arc& i) const {
|
deba@414
|
525 |
Parent::next(i);
|
deba@414
|
526 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
|
deba@414
|
527 |
}
|
deba@414
|
528 |
void next(Edge& i) const {
|
deba@414
|
529 |
Parent::next(i);
|
deba@414
|
530 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
|
deba@414
|
531 |
}
|
deba@414
|
532 |
void nextIn(Arc& i) const {
|
deba@414
|
533 |
Parent::nextIn(i);
|
deba@414
|
534 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i);
|
deba@414
|
535 |
}
|
deba@414
|
536 |
|
deba@414
|
537 |
void nextOut(Arc& i) const {
|
deba@414
|
538 |
Parent::nextOut(i);
|
deba@414
|
539 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i);
|
deba@414
|
540 |
}
|
deba@414
|
541 |
void nextInc(Edge& i, bool& d) const {
|
deba@414
|
542 |
Parent::nextInc(i, d);
|
deba@414
|
543 |
while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
|
deba@414
|
544 |
}
|
deba@414
|
545 |
|
deba@414
|
546 |
/// \brief Hide the given node in the graph.
|
deba@414
|
547 |
///
|
deba@414
|
548 |
/// This function hides \c n in the graph, i.e. the iteration
|
deba@414
|
549 |
/// jumps over it. This is done by simply setting the value of \c n
|
deba@414
|
550 |
/// to be false in the corresponding node-map.
|
deba@414
|
551 |
void hide(const Node& n) const { _node_filter_map->set(n, false); }
|
deba@414
|
552 |
|
deba@414
|
553 |
/// \brief Hide the given edge in the graph.
|
deba@414
|
554 |
///
|
deba@414
|
555 |
/// This function hides \c e in the graph, i.e. the iteration
|
deba@414
|
556 |
/// jumps over it. This is done by simply setting the value of \c e
|
deba@414
|
557 |
/// to be false in the corresponding edge-map.
|
deba@414
|
558 |
void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
|
deba@414
|
559 |
|
deba@414
|
560 |
/// \brief Unhide the given node in the graph.
|
deba@414
|
561 |
///
|
deba@414
|
562 |
/// The value of \c n is set to be true in the node-map which stores
|
deba@414
|
563 |
/// hide information. If \c n was hidden previuosly, then it is shown
|
deba@414
|
564 |
/// again
|
deba@414
|
565 |
void unHide(const Node& n) const { _node_filter_map->set(n, true); }
|
deba@414
|
566 |
|
deba@414
|
567 |
/// \brief Hide the given edge in the graph.
|
deba@414
|
568 |
///
|
deba@414
|
569 |
/// The value of \c e is set to be true in the edge-map which stores
|
deba@414
|
570 |
/// hide information. If \c e was hidden previuosly, then it is shown
|
deba@414
|
571 |
/// again
|
deba@414
|
572 |
void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
|
deba@414
|
573 |
|
deba@414
|
574 |
/// \brief Returns true if \c n is hidden.
|
deba@414
|
575 |
///
|
deba@414
|
576 |
/// Returns true if \c n is hidden.
|
deba@414
|
577 |
bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
|
deba@414
|
578 |
|
deba@414
|
579 |
/// \brief Returns true if \c e is hidden.
|
deba@414
|
580 |
///
|
deba@414
|
581 |
/// Returns true if \c e is hidden.
|
deba@414
|
582 |
bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
|
deba@414
|
583 |
|
deba@414
|
584 |
typedef False NodeNumTag;
|
deba@414
|
585 |
typedef False EdgeNumTag;
|
deba@414
|
586 |
|
deba@414
|
587 |
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
|
deba@414
|
588 |
Arc findArc(const Node& u, const Node& v,
|
deba@414
|
589 |
const Arc& prev = INVALID) {
|
deba@414
|
590 |
Arc arc = Parent::findArc(u, v, prev);
|
deba@414
|
591 |
while (arc != INVALID && !(*_edge_filter_map)[arc]) {
|
deba@414
|
592 |
arc = Parent::findArc(u, v, arc);
|
deba@414
|
593 |
}
|
deba@414
|
594 |
return arc;
|
deba@414
|
595 |
}
|
deba@414
|
596 |
Edge findEdge(const Node& u, const Node& v,
|
deba@414
|
597 |
const Edge& prev = INVALID) {
|
deba@414
|
598 |
Edge edge = Parent::findEdge(u, v, prev);
|
deba@414
|
599 |
while (edge != INVALID && !(*_edge_filter_map)[edge]) {
|
deba@414
|
600 |
edge = Parent::findEdge(u, v, edge);
|
deba@414
|
601 |
}
|
deba@414
|
602 |
return edge;
|
deba@414
|
603 |
}
|
deba@414
|
604 |
|
deba@414
|
605 |
template <typename _Value>
|
deba@414
|
606 |
class NodeMap : public SubMapExtender<Adaptor,
|
deba@414
|
607 |
typename Parent::template NodeMap<_Value> > {
|
deba@414
|
608 |
public:
|
deba@414
|
609 |
typedef _Value Value;
|
deba@414
|
610 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
611 |
template NodeMap<Value> > MapParent;
|
deba@414
|
612 |
|
deba@414
|
613 |
NodeMap(const Adaptor& adaptor)
|
deba@414
|
614 |
: MapParent(adaptor) {}
|
deba@414
|
615 |
NodeMap(const Adaptor& adaptor, const Value& value)
|
deba@414
|
616 |
: MapParent(adaptor, value) {}
|
deba@414
|
617 |
|
deba@414
|
618 |
private:
|
deba@414
|
619 |
NodeMap& operator=(const NodeMap& cmap) {
|
deba@414
|
620 |
return operator=<NodeMap>(cmap);
|
deba@414
|
621 |
}
|
deba@414
|
622 |
|
deba@414
|
623 |
template <typename CMap>
|
deba@414
|
624 |
NodeMap& operator=(const CMap& cmap) {
|
deba@414
|
625 |
MapParent::operator=(cmap);
|
deba@414
|
626 |
return *this;
|
deba@414
|
627 |
}
|
deba@414
|
628 |
};
|
deba@414
|
629 |
|
deba@414
|
630 |
template <typename _Value>
|
deba@414
|
631 |
class ArcMap : public SubMapExtender<Adaptor,
|
deba@414
|
632 |
typename Parent::template ArcMap<_Value> > {
|
deba@414
|
633 |
public:
|
deba@414
|
634 |
typedef _Value Value;
|
deba@414
|
635 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
636 |
template ArcMap<Value> > MapParent;
|
deba@414
|
637 |
|
deba@414
|
638 |
ArcMap(const Adaptor& adaptor)
|
deba@414
|
639 |
: MapParent(adaptor) {}
|
deba@414
|
640 |
ArcMap(const Adaptor& adaptor, const Value& value)
|
deba@414
|
641 |
: MapParent(adaptor, value) {}
|
deba@414
|
642 |
|
deba@414
|
643 |
private:
|
deba@414
|
644 |
ArcMap& operator=(const ArcMap& cmap) {
|
deba@414
|
645 |
return operator=<ArcMap>(cmap);
|
deba@414
|
646 |
}
|
deba@414
|
647 |
|
deba@414
|
648 |
template <typename CMap>
|
deba@414
|
649 |
ArcMap& operator=(const CMap& cmap) {
|
deba@414
|
650 |
MapParent::operator=(cmap);
|
deba@414
|
651 |
return *this;
|
deba@414
|
652 |
}
|
deba@414
|
653 |
};
|
deba@414
|
654 |
|
deba@414
|
655 |
template <typename _Value>
|
deba@414
|
656 |
class EdgeMap : public SubMapExtender<Adaptor,
|
deba@414
|
657 |
typename Parent::template EdgeMap<_Value> > {
|
deba@414
|
658 |
public:
|
deba@414
|
659 |
typedef _Value Value;
|
deba@414
|
660 |
typedef SubMapExtender<Adaptor, typename Parent::
|
deba@414
|
661 |
template EdgeMap<Value> > MapParent;
|
deba@414
|
662 |
|
deba@414
|
663 |
EdgeMap(const Adaptor& adaptor)
|
deba@414
|
664 |
: MapParent(adaptor) {}
|
deba@414
|
665 |
|
deba@414
|
666 |
EdgeMap(const Adaptor& adaptor, const _Value& value)
|
deba@414
|
667 |
: MapParent(adaptor, value) {}
|
deba@414
|
668 |
|
deba@414
|
669 |
private:
|
deba@414
|
670 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
deba@414
|
671 |
return operator=<EdgeMap>(cmap);
|
deba@414
|
672 |
}
|
deba@414
|
673 |
|
deba@414
|
674 |
template <typename CMap>
|
deba@414
|
675 |
EdgeMap& operator=(const CMap& cmap) {
|
deba@414
|
676 |
MapParent::operator=(cmap);
|
deba@414
|
677 |
return *this;
|
deba@414
|
678 |
}
|
deba@414
|
679 |
};
|
deba@414
|
680 |
|
deba@414
|
681 |
};
|
deba@414
|
682 |
|
deba@414
|
683 |
/// \ingroup graph_adaptors
|
deba@414
|
684 |
///
|
deba@414
|
685 |
/// \brief A graph adaptor for hiding nodes and arcs from an
|
deba@414
|
686 |
/// undirected graph.
|
deba@414
|
687 |
///
|
deba@414
|
688 |
/// SubGraphAdaptor shows the graph with filtered node-set and
|
deba@414
|
689 |
/// edge-set. If the \c checked parameter is true then it filters
|
deba@414
|
690 |
/// the edge-set to do not get invalid edges which incident node is
|
deba@414
|
691 |
/// filtered.
|
deba@414
|
692 |
///
|
deba@414
|
693 |
/// If the \c checked template parameter is false then we have to
|
deba@414
|
694 |
/// note that the node-iterator cares only the filter on the
|
deba@414
|
695 |
/// node-set, and the edge-iterator cares only the filter on the
|
deba@414
|
696 |
/// edge-set. This way the edge-map should filter all arcs which
|
deba@414
|
697 |
/// has filtered end node.
|
deba@414
|
698 |
template<typename _Graph, typename NodeFilterMap,
|
deba@414
|
699 |
typename EdgeFilterMap, bool checked = true>
|
deba@414
|
700 |
class SubGraphAdaptor :
|
deba@414
|
701 |
public GraphAdaptorExtender<
|
deba@414
|
702 |
SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, checked> > {
|
deba@414
|
703 |
public:
|
deba@414
|
704 |
typedef _Graph Graph;
|
deba@414
|
705 |
typedef GraphAdaptorExtender<
|
deba@414
|
706 |
SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent;
|
deba@414
|
707 |
protected:
|
deba@414
|
708 |
SubGraphAdaptor() { }
|
deba@414
|
709 |
public:
|
deba@414
|
710 |
SubGraphAdaptor(Graph& _graph, NodeFilterMap& node_filter_map,
|
deba@414
|
711 |
EdgeFilterMap& edge_filter_map) {
|
deba@414
|
712 |
setGraph(_graph);
|
deba@414
|
713 |
setNodeFilterMap(node_filter_map);
|
deba@414
|
714 |
setEdgeFilterMap(edge_filter_map);
|
deba@414
|
715 |
}
|
deba@414
|
716 |
};
|
deba@414
|
717 |
|
deba@414
|
718 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
|
deba@414
|
719 |
SubGraphAdaptor<const Graph, NodeFilterMap, ArcFilterMap>
|
deba@414
|
720 |
subGraphAdaptor(const Graph& graph,
|
deba@414
|
721 |
NodeFilterMap& nfm, ArcFilterMap& efm) {
|
deba@414
|
722 |
return SubGraphAdaptor<const Graph, NodeFilterMap, ArcFilterMap>
|
deba@414
|
723 |
(graph, nfm, efm);
|
deba@414
|
724 |
}
|
deba@414
|
725 |
|
deba@414
|
726 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
|
deba@414
|
727 |
SubGraphAdaptor<const Graph, const NodeFilterMap, ArcFilterMap>
|
deba@414
|
728 |
subGraphAdaptor(const Graph& graph,
|
deba@414
|
729 |
NodeFilterMap& nfm, ArcFilterMap& efm) {
|
deba@414
|
730 |
return SubGraphAdaptor<const Graph, const NodeFilterMap, ArcFilterMap>
|
deba@414
|
731 |
(graph, nfm, efm);
|
deba@414
|
732 |
}
|
deba@414
|
733 |
|
deba@414
|
734 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
|
deba@414
|
735 |
SubGraphAdaptor<const Graph, NodeFilterMap, const ArcFilterMap>
|
deba@414
|
736 |
subGraphAdaptor(const Graph& graph,
|
deba@414
|
737 |
NodeFilterMap& nfm, ArcFilterMap& efm) {
|
deba@414
|
738 |
return SubGraphAdaptor<const Graph, NodeFilterMap, const ArcFilterMap>
|
deba@414
|
739 |
(graph, nfm, efm);
|
deba@414
|
740 |
}
|
deba@414
|
741 |
|
deba@414
|
742 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap>
|
deba@414
|
743 |
SubGraphAdaptor<const Graph, const NodeFilterMap, const ArcFilterMap>
|
deba@414
|
744 |
subGraphAdaptor(const Graph& graph,
|
deba@414
|
745 |
NodeFilterMap& nfm, ArcFilterMap& efm) {
|
deba@414
|
746 |
return SubGraphAdaptor<const Graph, const NodeFilterMap,
|
deba@414
|
747 |
const ArcFilterMap>(graph, nfm, efm);
|
deba@414
|
748 |
}
|
deba@414
|
749 |
|
deba@414
|
750 |
/// \ingroup graph_adaptors
|
deba@414
|
751 |
///
|
deba@414
|
752 |
/// \brief An adaptor for hiding nodes from an graph.
|
deba@414
|
753 |
///
|
deba@414
|
754 |
/// An adaptor for hiding nodes from an graph. This
|
deba@414
|
755 |
/// adaptor specializes SubGraphAdaptor in the way that only the
|
deba@414
|
756 |
/// node-set can be filtered. In usual case the checked parameter is
|
deba@414
|
757 |
/// true, we get the induced subgraph. But if the checked parameter
|
deba@414
|
758 |
/// is false then we can filter only isolated nodes.
|
deba@414
|
759 |
template<typename _Graph, typename _NodeFilterMap, bool checked = true>
|
deba@414
|
760 |
class NodeSubGraphAdaptor :
|
deba@414
|
761 |
public SubGraphAdaptor<_Graph, _NodeFilterMap,
|
deba@414
|
762 |
ConstMap<typename _Graph::Edge, bool>, checked> {
|
deba@414
|
763 |
public:
|
deba@414
|
764 |
typedef _Graph Graph;
|
deba@414
|
765 |
typedef _NodeFilterMap NodeFilterMap;
|
deba@414
|
766 |
typedef SubGraphAdaptor<Graph, NodeFilterMap,
|
deba@414
|
767 |
ConstMap<typename Graph::Edge, bool> > Parent;
|
deba@414
|
768 |
protected:
|
deba@414
|
769 |
ConstMap<typename Graph::Edge, bool> const_true_map;
|
deba@414
|
770 |
|
deba@414
|
771 |
NodeSubGraphAdaptor() : const_true_map(true) {
|
deba@414
|
772 |
Parent::setEdgeFilterMap(const_true_map);
|
deba@414
|
773 |
}
|
deba@414
|
774 |
|
deba@414
|
775 |
public:
|
deba@414
|
776 |
NodeSubGraphAdaptor(Graph& _graph, NodeFilterMap& node_filter_map) :
|
deba@414
|
777 |
Parent(), const_true_map(true) {
|
deba@414
|
778 |
Parent::setGraph(_graph);
|
deba@414
|
779 |
Parent::setNodeFilterMap(node_filter_map);
|
deba@414
|
780 |
Parent::setEdgeFilterMap(const_true_map);
|
deba@414
|
781 |
}
|
deba@414
|
782 |
};
|
deba@414
|
783 |
|
deba@414
|
784 |
template<typename Graph, typename NodeFilterMap>
|
deba@414
|
785 |
NodeSubGraphAdaptor<const Graph, NodeFilterMap>
|
deba@414
|
786 |
nodeSubGraphAdaptor(const Graph& graph, NodeFilterMap& nfm) {
|
deba@414
|
787 |
return NodeSubGraphAdaptor<const Graph, NodeFilterMap>(graph, nfm);
|
deba@414
|
788 |
}
|
deba@414
|
789 |
|
deba@414
|
790 |
template<typename Graph, typename NodeFilterMap>
|
deba@414
|
791 |
NodeSubGraphAdaptor<const Graph, const NodeFilterMap>
|
deba@414
|
792 |
nodeSubGraphAdaptor(const Graph& graph, const NodeFilterMap& nfm) {
|
deba@414
|
793 |
return NodeSubGraphAdaptor<const Graph, const NodeFilterMap>(graph, nfm);
|
deba@414
|
794 |
}
|
deba@414
|
795 |
|
deba@414
|
796 |
/// \ingroup graph_adaptors
|
deba@414
|
797 |
///
|
deba@414
|
798 |
/// \brief An adaptor for hiding edges from an graph.
|
deba@414
|
799 |
///
|
deba@414
|
800 |
/// \warning Graph adaptors are in even more experimental state
|
deba@414
|
801 |
/// than the other parts of the lib. Use them at you own risk.
|
deba@414
|
802 |
///
|
deba@414
|
803 |
/// An adaptor for hiding edges from an graph.
|
deba@414
|
804 |
/// This adaptor specializes SubGraphAdaptor in the way that
|
deba@414
|
805 |
/// only the arc-set
|
deba@414
|
806 |
/// can be filtered.
|
deba@414
|
807 |
template<typename _Graph, typename _EdgeFilterMap>
|
deba@414
|
808 |
class EdgeSubGraphAdaptor :
|
deba@414
|
809 |
public SubGraphAdaptor<_Graph, ConstMap<typename _Graph::Node,bool>,
|
deba@414
|
810 |
_EdgeFilterMap, false> {
|
deba@414
|
811 |
public:
|
deba@414
|
812 |
typedef _Graph Graph;
|
deba@414
|
813 |
typedef _EdgeFilterMap EdgeFilterMap;
|
deba@414
|
814 |
typedef SubGraphAdaptor<Graph, ConstMap<typename Graph::Node,bool>,
|
deba@414
|
815 |
EdgeFilterMap, false> Parent;
|
deba@414
|
816 |
protected:
|
deba@414
|
817 |
ConstMap<typename Graph::Node, bool> const_true_map;
|
deba@414
|
818 |
|
deba@414
|
819 |
EdgeSubGraphAdaptor() : const_true_map(true) {
|
deba@414
|
820 |
Parent::setNodeFilterMap(const_true_map);
|
deba@414
|
821 |
}
|
deba@414
|
822 |
|
deba@414
|
823 |
public:
|
deba@414
|
824 |
|
deba@414
|
825 |
EdgeSubGraphAdaptor(Graph& _graph, EdgeFilterMap& edge_filter_map) :
|
deba@414
|
826 |
Parent(), const_true_map(true) {
|
deba@414
|
827 |
Parent::setGraph(_graph);
|
deba@414
|
828 |
Parent::setNodeFilterMap(const_true_map);
|
deba@414
|
829 |
Parent::setEdgeFilterMap(edge_filter_map);
|
deba@414
|
830 |
}
|
deba@414
|
831 |
|
deba@414
|
832 |
};
|
deba@414
|
833 |
|
deba@414
|
834 |
template<typename Graph, typename EdgeFilterMap>
|
deba@414
|
835 |
EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>
|
deba@414
|
836 |
edgeSubGraphAdaptor(const Graph& graph, EdgeFilterMap& efm) {
|
deba@414
|
837 |
return EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>(graph, efm);
|
deba@414
|
838 |
}
|
deba@414
|
839 |
|
deba@414
|
840 |
template<typename Graph, typename EdgeFilterMap>
|
deba@414
|
841 |
EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>
|
deba@414
|
842 |
edgeSubGraphAdaptor(const Graph& graph, const EdgeFilterMap& efm) {
|
deba@414
|
843 |
return EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>(graph, efm);
|
deba@414
|
844 |
}
|
deba@414
|
845 |
|
deba@414
|
846 |
/// \brief Base of direct graph adaptor
|
deba@414
|
847 |
///
|
deba@414
|
848 |
/// Base class of the direct graph adaptor. All public member
|
deba@414
|
849 |
/// of this class can be used with the DirGraphAdaptor too.
|
deba@414
|
850 |
/// \sa DirGraphAdaptor
|
deba@414
|
851 |
template <typename _Graph, typename _DirectionMap>
|
deba@414
|
852 |
class DirGraphAdaptorBase {
|
deba@414
|
853 |
public:
|
deba@414
|
854 |
|
deba@414
|
855 |
typedef _Graph Graph;
|
deba@414
|
856 |
typedef _DirectionMap DirectionMap;
|
deba@414
|
857 |
|
deba@414
|
858 |
typedef typename Graph::Node Node;
|
deba@414
|
859 |
typedef typename Graph::Edge Arc;
|
deba@414
|
860 |
|
deba@414
|
861 |
/// \brief Reverse arc
|
deba@414
|
862 |
///
|
deba@414
|
863 |
/// It reverse the given arc. It simply negate the direction in the map.
|
deba@414
|
864 |
void reverseArc(const Arc& arc) {
|
deba@414
|
865 |
_direction->set(arc, !(*_direction)[arc]);
|
deba@414
|
866 |
}
|
deba@414
|
867 |
|
deba@414
|
868 |
void first(Node& i) const { _graph->first(i); }
|
deba@414
|
869 |
void first(Arc& i) const { _graph->first(i); }
|
deba@414
|
870 |
void firstIn(Arc& i, const Node& n) const {
|
deba@414
|
871 |
bool d;
|
deba@414
|
872 |
_graph->firstInc(i, d, n);
|
deba@414
|
873 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
|
deba@414
|
874 |
}
|
deba@414
|
875 |
void firstOut(Arc& i, const Node& n ) const {
|
deba@414
|
876 |
bool d;
|
deba@414
|
877 |
_graph->firstInc(i, d, n);
|
deba@414
|
878 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
|
deba@414
|
879 |
}
|
deba@414
|
880 |
|
deba@414
|
881 |
void next(Node& i) const { _graph->next(i); }
|
deba@414
|
882 |
void next(Arc& i) const { _graph->next(i); }
|
deba@414
|
883 |
void nextIn(Arc& i) const {
|
deba@414
|
884 |
bool d = !(*_direction)[i];
|
deba@414
|
885 |
_graph->nextInc(i, d);
|
deba@414
|
886 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
|
deba@414
|
887 |
}
|
deba@414
|
888 |
void nextOut(Arc& i) const {
|
deba@414
|
889 |
bool d = (*_direction)[i];
|
deba@414
|
890 |
_graph->nextInc(i, d);
|
deba@414
|
891 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
|
deba@414
|
892 |
}
|
deba@414
|
893 |
|
deba@414
|
894 |
Node source(const Arc& e) const {
|
deba@414
|
895 |
return (*_direction)[e] ? _graph->u(e) : _graph->v(e);
|
deba@414
|
896 |
}
|
deba@414
|
897 |
Node target(const Arc& e) const {
|
deba@414
|
898 |
return (*_direction)[e] ? _graph->v(e) : _graph->u(e);
|
deba@414
|
899 |
}
|
deba@414
|
900 |
|
deba@414
|
901 |
typedef NodeNumTagIndicator<Graph> NodeNumTag;
|
deba@414
|
902 |
int nodeNum() const { return _graph->nodeNum(); }
|
deba@414
|
903 |
|
deba@414
|
904 |
typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
|
deba@414
|
905 |
int arcNum() const { return _graph->edgeNum(); }
|
deba@414
|
906 |
|
deba@414
|
907 |
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
|
deba@414
|
908 |
Arc findArc(const Node& u, const Node& v,
|
deba@414
|
909 |
const Arc& prev = INVALID) {
|
deba@414
|
910 |
Arc arc = prev;
|
deba@414
|
911 |
bool d = arc == INVALID ? true : (*_direction)[arc];
|
deba@414
|
912 |
if (d) {
|
deba@414
|
913 |
arc = _graph->findEdge(u, v, arc);
|
deba@414
|
914 |
while (arc != INVALID && !(*_direction)[arc]) {
|
deba@414
|
915 |
_graph->findEdge(u, v, arc);
|
deba@414
|
916 |
}
|
deba@414
|
917 |
if (arc != INVALID) return arc;
|
deba@414
|
918 |
}
|
deba@414
|
919 |
_graph->findEdge(v, u, arc);
|
deba@414
|
920 |
while (arc != INVALID && (*_direction)[arc]) {
|
deba@414
|
921 |
_graph->findEdge(u, v, arc);
|
deba@414
|
922 |
}
|
deba@414
|
923 |
return arc;
|
deba@414
|
924 |
}
|
deba@414
|
925 |
|
deba@414
|
926 |
Node addNode() {
|
deba@414
|
927 |
return Node(_graph->addNode());
|
deba@414
|
928 |
}
|
deba@414
|
929 |
|
deba@414
|
930 |
Arc addArc(const Node& u, const Node& v) {
|
deba@414
|
931 |
Arc arc = _graph->addArc(u, v);
|
deba@414
|
932 |
_direction->set(arc, _graph->source(arc) == u);
|
deba@414
|
933 |
return arc;
|
deba@414
|
934 |
}
|
deba@414
|
935 |
|
deba@414
|
936 |
void erase(const Node& i) { _graph->erase(i); }
|
deba@414
|
937 |
void erase(const Arc& i) { _graph->erase(i); }
|
deba@414
|
938 |
|
deba@414
|
939 |
void clear() { _graph->clear(); }
|
deba@414
|
940 |
|
deba@414
|
941 |
int id(const Node& v) const { return _graph->id(v); }
|
deba@414
|
942 |
int id(const Arc& e) const { return _graph->id(e); }
|
deba@414
|
943 |
|
deba@414
|
944 |
Node nodeFromId(int idx) const { return _graph->nodeFromId(idx); }
|
deba@414
|
945 |
Arc arcFromId(int idx) const { return _graph->edgeFromId(idx); }
|
deba@414
|
946 |
|
deba@414
|
947 |
int maxNodeId() const { return _graph->maxNodeId(); }
|
deba@414
|
948 |
int maxArcId() const { return _graph->maxEdgeId(); }
|
deba@414
|
949 |
|
deba@414
|
950 |
typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
|
deba@414
|
951 |
NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
|
deba@414
|
952 |
|
deba@414
|
953 |
typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
|
deba@414
|
954 |
ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
|
deba@414
|
955 |
|
deba@414
|
956 |
template <typename _Value>
|
deba@414
|
957 |
class NodeMap : public _Graph::template NodeMap<_Value> {
|
deba@414
|
958 |
public:
|
deba@414
|
959 |
|
deba@414
|
960 |
typedef typename _Graph::template NodeMap<_Value> Parent;
|
deba@414
|
961 |
|
deba@414
|
962 |
explicit NodeMap(const DirGraphAdaptorBase& adapter)
|
deba@414
|
963 |
: Parent(*adapter._graph) {}
|
deba@414
|
964 |
|
deba@414
|
965 |
NodeMap(const DirGraphAdaptorBase& adapter, const _Value& value)
|
deba@414
|
966 |
: Parent(*adapter._graph, value) {}
|
deba@414
|
967 |
|
deba@414
|
968 |
private:
|
deba@414
|
969 |
NodeMap& operator=(const NodeMap& cmap) {
|
deba@414
|
970 |
return operator=<NodeMap>(cmap);
|
deba@414
|
971 |
}
|
deba@414
|
972 |
|
deba@414
|
973 |
template <typename CMap>
|
deba@414
|
974 |
NodeMap& operator=(const CMap& cmap) {
|
deba@414
|
975 |
Parent::operator=(cmap);
|
deba@414
|
976 |
return *this;
|
deba@414
|
977 |
}
|
deba@414
|
978 |
|
deba@414
|
979 |
};
|
deba@414
|
980 |
|
deba@414
|
981 |
template <typename _Value>
|
deba@414
|
982 |
class ArcMap : public _Graph::template EdgeMap<_Value> {
|
deba@414
|
983 |
public:
|
deba@414
|
984 |
|
deba@414
|
985 |
typedef typename Graph::template EdgeMap<_Value> Parent;
|
deba@414
|
986 |
|
deba@414
|
987 |
explicit ArcMap(const DirGraphAdaptorBase& adapter)
|
deba@414
|
988 |
: Parent(*adapter._graph) { }
|
deba@414
|
989 |
|
deba@414
|
990 |
ArcMap(const DirGraphAdaptorBase& adapter, const _Value& value)
|
deba@414
|
991 |
: Parent(*adapter._graph, value) { }
|
deba@414
|
992 |
|
deba@414
|
993 |
private:
|
deba@414
|
994 |
ArcMap& operator=(const ArcMap& cmap) {
|
deba@414
|
995 |
return operator=<ArcMap>(cmap);
|
deba@414
|
996 |
}
|
deba@414
|
997 |
|
deba@414
|
998 |
template <typename CMap>
|
deba@414
|
999 |
ArcMap& operator=(const CMap& cmap) {
|
deba@414
|
1000 |
Parent::operator=(cmap);
|
deba@414
|
1001 |
return *this;
|
deba@414
|
1002 |
}
|
deba@414
|
1003 |
};
|
deba@414
|
1004 |
|
deba@414
|
1005 |
|
deba@414
|
1006 |
|
deba@414
|
1007 |
protected:
|
deba@414
|
1008 |
Graph* _graph;
|
deba@414
|
1009 |
DirectionMap* _direction;
|
deba@414
|
1010 |
|
deba@414
|
1011 |
void setDirectionMap(DirectionMap& direction) {
|
deba@414
|
1012 |
_direction = &direction;
|
deba@414
|
1013 |
}
|
deba@414
|
1014 |
|
deba@414
|
1015 |
void setGraph(Graph& graph) {
|
deba@414
|
1016 |
_graph = &graph;
|
deba@414
|
1017 |
}
|
deba@414
|
1018 |
|
deba@414
|
1019 |
};
|
deba@414
|
1020 |
|
deba@414
|
1021 |
|
deba@414
|
1022 |
/// \ingroup graph_adaptors
|
deba@414
|
1023 |
///
|
deba@414
|
1024 |
/// \brief A directed graph is made from an graph by an adaptor
|
deba@414
|
1025 |
///
|
deba@414
|
1026 |
/// This adaptor gives a direction for each edge in the undirected
|
deba@414
|
1027 |
/// graph. The direction of the arcs stored in the
|
deba@414
|
1028 |
/// DirectionMap. This map is a bool map on the edges. If
|
deba@414
|
1029 |
/// the edge is mapped to true then the direction of the directed
|
deba@414
|
1030 |
/// arc will be the same as the default direction of the edge. The
|
deba@414
|
1031 |
/// arcs can be easily reverted by the \ref
|
deba@414
|
1032 |
/// DirGraphAdaptorBase::reverseArc "reverseArc()" member in the
|
deba@414
|
1033 |
/// adaptor.
|
deba@414
|
1034 |
///
|
deba@414
|
1035 |
/// It can be used to solve orientation problems on directed graphs.
|
deba@414
|
1036 |
/// For example how can we orient an graph to get the minimum
|
deba@414
|
1037 |
/// number of strongly connected components. If we orient the arcs with
|
deba@414
|
1038 |
/// the dfs algorithm out from the source then we will get such an
|
deba@414
|
1039 |
/// orientation.
|
deba@414
|
1040 |
///
|
deba@414
|
1041 |
/// We use the \ref DfsVisitor "visitor" interface of the
|
deba@414
|
1042 |
/// \ref DfsVisit "dfs" algorithm:
|
deba@414
|
1043 |
///\code
|
deba@414
|
1044 |
/// template <typename DirMap>
|
deba@414
|
1045 |
/// class OrientVisitor : public DfsVisitor<Graph> {
|
deba@414
|
1046 |
/// public:
|
deba@414
|
1047 |
///
|
deba@414
|
1048 |
/// OrientVisitor(const Graph& graph, DirMap& dirMap)
|
deba@414
|
1049 |
/// : _graph(graph), _dirMap(dirMap), _processed(graph, false) {}
|
deba@414
|
1050 |
///
|
deba@414
|
1051 |
/// void discover(const Arc& arc) {
|
deba@414
|
1052 |
/// _processed.set(arc, true);
|
deba@414
|
1053 |
/// _dirMap.set(arc, _graph.direction(arc));
|
deba@414
|
1054 |
/// }
|
deba@414
|
1055 |
///
|
deba@414
|
1056 |
/// void examine(const Arc& arc) {
|
deba@414
|
1057 |
/// if (_processed[arc]) return;
|
deba@414
|
1058 |
/// _processed.set(arc, true);
|
deba@414
|
1059 |
/// _dirMap.set(arc, _graph.direction(arc));
|
deba@414
|
1060 |
/// }
|
deba@414
|
1061 |
///
|
deba@414
|
1062 |
/// private:
|
deba@414
|
1063 |
/// const Graph& _graph;
|
deba@414
|
1064 |
/// DirMap& _dirMap;
|
deba@414
|
1065 |
/// Graph::EdgeMap<bool> _processed;
|
deba@414
|
1066 |
/// };
|
deba@414
|
1067 |
///\endcode
|
deba@414
|
1068 |
///
|
deba@414
|
1069 |
/// And now we can use the orientation:
|
deba@414
|
1070 |
///\code
|
deba@414
|
1071 |
/// Graph::EdgeMap<bool> dmap(graph);
|
deba@414
|
1072 |
///
|
deba@414
|
1073 |
/// typedef OrientVisitor<Graph::EdgeMap<bool> > Visitor;
|
deba@414
|
1074 |
/// Visitor visitor(graph, dmap);
|
deba@414
|
1075 |
///
|
deba@414
|
1076 |
/// DfsVisit<Graph, Visitor> dfs(graph, visitor);
|
deba@414
|
1077 |
///
|
deba@414
|
1078 |
/// dfs.run();
|
deba@414
|
1079 |
///
|
deba@414
|
1080 |
/// typedef DirGraphAdaptor<Graph> DGraph;
|
deba@414
|
1081 |
/// DGraph dgraph(graph, dmap);
|
deba@414
|
1082 |
///
|
deba@414
|
1083 |
/// LEMON_ASSERT(countStronglyConnectedComponents(dgraph) ==
|
deba@414
|
1084 |
/// countBiArcConnectedComponents(graph), "Wrong Orientation");
|
deba@414
|
1085 |
///\endcode
|
deba@414
|
1086 |
///
|
deba@414
|
1087 |
/// The number of the bi-connected components is a lower bound for
|
deba@414
|
1088 |
/// the number of the strongly connected components in the directed
|
deba@414
|
1089 |
/// graph because if we contract the bi-connected components to
|
deba@414
|
1090 |
/// nodes we will get a tree therefore we cannot orient arcs in
|
deba@414
|
1091 |
/// both direction between bi-connected components. In the other way
|
deba@414
|
1092 |
/// the algorithm will orient one component to be strongly
|
deba@414
|
1093 |
/// connected. The two relations proof that the assertion will
|
deba@414
|
1094 |
/// be always true and the found solution is optimal.
|
deba@414
|
1095 |
///
|
deba@414
|
1096 |
/// \sa DirGraphAdaptorBase
|
deba@414
|
1097 |
/// \sa dirGraphAdaptor
|
deba@414
|
1098 |
template<typename _Graph,
|
deba@414
|
1099 |
typename DirectionMap = typename _Graph::template EdgeMap<bool> >
|
deba@414
|
1100 |
class DirGraphAdaptor :
|
deba@414
|
1101 |
public DigraphAdaptorExtender<DirGraphAdaptorBase<_Graph, DirectionMap> > {
|
deba@414
|
1102 |
public:
|
deba@414
|
1103 |
typedef _Graph Graph;
|
deba@414
|
1104 |
typedef DigraphAdaptorExtender<
|
deba@414
|
1105 |
DirGraphAdaptorBase<_Graph, DirectionMap> > Parent;
|
deba@414
|
1106 |
protected:
|
deba@414
|
1107 |
DirGraphAdaptor() { }
|
deba@414
|
1108 |
public:
|
deba@414
|
1109 |
|
deba@414
|
1110 |
/// \brief Constructor of the adaptor
|
deba@414
|
1111 |
///
|
deba@414
|
1112 |
/// Constructor of the adaptor
|
deba@414
|
1113 |
DirGraphAdaptor(Graph& graph, DirectionMap& direction) {
|
deba@414
|
1114 |
setGraph(graph);
|
deba@414
|
1115 |
setDirectionMap(direction);
|
deba@414
|
1116 |
}
|
deba@414
|
1117 |
};
|
deba@414
|
1118 |
|
deba@414
|
1119 |
/// \brief Just gives back a DirGraphAdaptor
|
deba@414
|
1120 |
///
|
deba@414
|
1121 |
/// Just gives back a DirGraphAdaptor
|
deba@414
|
1122 |
template<typename Graph, typename DirectionMap>
|
deba@414
|
1123 |
DirGraphAdaptor<const Graph, DirectionMap>
|
deba@414
|
1124 |
dirGraphAdaptor(const Graph& graph, DirectionMap& dm) {
|
deba@414
|
1125 |
return DirGraphAdaptor<const Graph, DirectionMap>(graph, dm);
|
deba@414
|
1126 |
}
|
deba@414
|
1127 |
|
deba@414
|
1128 |
template<typename Graph, typename DirectionMap>
|
deba@414
|
1129 |
DirGraphAdaptor<const Graph, const DirectionMap>
|
deba@414
|
1130 |
dirGraphAdaptor(const Graph& graph, const DirectionMap& dm) {
|
deba@414
|
1131 |
return DirGraphAdaptor<const Graph, const DirectionMap>(graph, dm);
|
deba@414
|
1132 |
}
|
deba@414
|
1133 |
|
deba@414
|
1134 |
}
|
deba@414
|
1135 |
|
deba@414
|
1136 |
#endif
|