1.1 --- a/lemon/adaptors.h Fri Jan 23 16:42:07 2009 +0000
1.2 +++ b/lemon/adaptors.h Fri Feb 13 13:29:28 2009 +0100
1.3 @@ -36,23 +36,28 @@
1.4
1.5 namespace lemon {
1.6
1.7 - template<typename _Digraph>
1.8 +#ifdef _MSC_VER
1.9 +#define LEMON_SCOPE_FIX(OUTER, NESTED) OUTER::NESTED
1.10 +#else
1.11 +#define LEMON_SCOPE_FIX(OUTER, NESTED) typename OUTER::template NESTED
1.12 +#endif
1.13 +
1.14 + template<typename DGR>
1.15 class DigraphAdaptorBase {
1.16 public:
1.17 - typedef _Digraph Digraph;
1.18 + typedef DGR Digraph;
1.19 typedef DigraphAdaptorBase Adaptor;
1.20 - typedef Digraph ParentDigraph;
1.21
1.22 protected:
1.23 - Digraph* _digraph;
1.24 + DGR* _digraph;
1.25 DigraphAdaptorBase() : _digraph(0) { }
1.26 - void setDigraph(Digraph& digraph) { _digraph = &digraph; }
1.27 + void initialize(DGR& digraph) { _digraph = &digraph; }
1.28
1.29 public:
1.30 - DigraphAdaptorBase(Digraph& digraph) : _digraph(&digraph) { }
1.31 -
1.32 - typedef typename Digraph::Node Node;
1.33 - typedef typename Digraph::Arc Arc;
1.34 + DigraphAdaptorBase(DGR& digraph) : _digraph(&digraph) { }
1.35 +
1.36 + typedef typename DGR::Node Node;
1.37 + typedef typename DGR::Arc Arc;
1.38
1.39 void first(Node& i) const { _digraph->first(i); }
1.40 void first(Arc& i) const { _digraph->first(i); }
1.41 @@ -67,13 +72,13 @@
1.42 Node source(const Arc& a) const { return _digraph->source(a); }
1.43 Node target(const Arc& a) const { return _digraph->target(a); }
1.44
1.45 - typedef NodeNumTagIndicator<Digraph> NodeNumTag;
1.46 + typedef NodeNumTagIndicator<DGR> NodeNumTag;
1.47 int nodeNum() const { return _digraph->nodeNum(); }
1.48
1.49 - typedef ArcNumTagIndicator<Digraph> ArcNumTag;
1.50 + typedef ArcNumTagIndicator<DGR> ArcNumTag;
1.51 int arcNum() const { return _digraph->arcNum(); }
1.52
1.53 - typedef FindArcTagIndicator<Digraph> FindArcTag;
1.54 + typedef FindArcTagIndicator<DGR> FindArcTag;
1.55 Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const {
1.56 return _digraph->findArc(u, v, prev);
1.57 }
1.58 @@ -95,22 +100,22 @@
1.59 int maxNodeId() const { return _digraph->maxNodeId(); }
1.60 int maxArcId() const { return _digraph->maxArcId(); }
1.61
1.62 - typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
1.63 + typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier;
1.64 NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
1.65
1.66 - typedef typename ItemSetTraits<Digraph, Arc>::ItemNotifier ArcNotifier;
1.67 + typedef typename ItemSetTraits<DGR, Arc>::ItemNotifier ArcNotifier;
1.68 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Arc()); }
1.69
1.70 - template <typename _Value>
1.71 - class NodeMap : public Digraph::template NodeMap<_Value> {
1.72 + template <typename V>
1.73 + class NodeMap : public DGR::template NodeMap<V> {
1.74 public:
1.75
1.76 - typedef typename Digraph::template NodeMap<_Value> Parent;
1.77 + typedef typename DGR::template NodeMap<V> Parent;
1.78
1.79 explicit NodeMap(const Adaptor& adaptor)
1.80 : Parent(*adaptor._digraph) {}
1.81
1.82 - NodeMap(const Adaptor& adaptor, const _Value& value)
1.83 + NodeMap(const Adaptor& adaptor, const V& value)
1.84 : Parent(*adaptor._digraph, value) { }
1.85
1.86 private:
1.87 @@ -126,16 +131,16 @@
1.88
1.89 };
1.90
1.91 - template <typename _Value>
1.92 - class ArcMap : public Digraph::template ArcMap<_Value> {
1.93 + template <typename V>
1.94 + class ArcMap : public DGR::template ArcMap<V> {
1.95 public:
1.96
1.97 - typedef typename Digraph::template ArcMap<_Value> Parent;
1.98 -
1.99 - explicit ArcMap(const Adaptor& adaptor)
1.100 + typedef typename DGR::template ArcMap<V> Parent;
1.101 +
1.102 + explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor)
1.103 : Parent(*adaptor._digraph) {}
1.104
1.105 - ArcMap(const Adaptor& adaptor, const _Value& value)
1.106 + ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value)
1.107 : Parent(*adaptor._digraph, value) {}
1.108
1.109 private:
1.110 @@ -153,25 +158,24 @@
1.111
1.112 };
1.113
1.114 - template<typename _Graph>
1.115 + template<typename GR>
1.116 class GraphAdaptorBase {
1.117 public:
1.118 - typedef _Graph Graph;
1.119 - typedef Graph ParentGraph;
1.120 + typedef GR Graph;
1.121
1.122 protected:
1.123 - Graph* _graph;
1.124 + GR* _graph;
1.125
1.126 GraphAdaptorBase() : _graph(0) {}
1.127
1.128 - void setGraph(Graph& graph) { _graph = &graph; }
1.129 + void initialize(GR& graph) { _graph = &graph; }
1.130
1.131 public:
1.132 - GraphAdaptorBase(Graph& graph) : _graph(&graph) {}
1.133 -
1.134 - typedef typename Graph::Node Node;
1.135 - typedef typename Graph::Arc Arc;
1.136 - typedef typename Graph::Edge Edge;
1.137 + GraphAdaptorBase(GR& graph) : _graph(&graph) {}
1.138 +
1.139 + typedef typename GR::Node Node;
1.140 + typedef typename GR::Arc Arc;
1.141 + typedef typename GR::Edge Edge;
1.142
1.143 void first(Node& i) const { _graph->first(i); }
1.144 void first(Arc& i) const { _graph->first(i); }
1.145 @@ -239,22 +243,22 @@
1.146 int maxArcId() const { return _graph->maxArcId(); }
1.147 int maxEdgeId() const { return _graph->maxEdgeId(); }
1.148
1.149 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
1.150 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
1.151 NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
1.152
1.153 - typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
1.154 + typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier;
1.155 ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
1.156
1.157 - typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier;
1.158 + typedef typename ItemSetTraits<GR, Edge>::ItemNotifier EdgeNotifier;
1.159 EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); }
1.160
1.161 - template <typename _Value>
1.162 - class NodeMap : public Graph::template NodeMap<_Value> {
1.163 + template <typename V>
1.164 + class NodeMap : public GR::template NodeMap<V> {
1.165 public:
1.166 - typedef typename Graph::template NodeMap<_Value> Parent;
1.167 - explicit NodeMap(const GraphAdaptorBase<Graph>& adapter)
1.168 + typedef typename GR::template NodeMap<V> Parent;
1.169 + explicit NodeMap(const GraphAdaptorBase<GR>& adapter)
1.170 : Parent(*adapter._graph) {}
1.171 - NodeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
1.172 + NodeMap(const GraphAdaptorBase<GR>& adapter, const V& value)
1.173 : Parent(*adapter._graph, value) {}
1.174
1.175 private:
1.176 @@ -270,13 +274,13 @@
1.177
1.178 };
1.179
1.180 - template <typename _Value>
1.181 - class ArcMap : public Graph::template ArcMap<_Value> {
1.182 + template <typename V>
1.183 + class ArcMap : public GR::template ArcMap<V> {
1.184 public:
1.185 - typedef typename Graph::template ArcMap<_Value> Parent;
1.186 - explicit ArcMap(const GraphAdaptorBase<Graph>& adapter)
1.187 + typedef typename GR::template ArcMap<V> Parent;
1.188 + explicit ArcMap(const GraphAdaptorBase<GR>& adapter)
1.189 : Parent(*adapter._graph) {}
1.190 - ArcMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
1.191 + ArcMap(const GraphAdaptorBase<GR>& adapter, const V& value)
1.192 : Parent(*adapter._graph, value) {}
1.193
1.194 private:
1.195 @@ -291,13 +295,13 @@
1.196 }
1.197 };
1.198
1.199 - template <typename _Value>
1.200 - class EdgeMap : public Graph::template EdgeMap<_Value> {
1.201 + template <typename V>
1.202 + class EdgeMap : public GR::template EdgeMap<V> {
1.203 public:
1.204 - typedef typename Graph::template EdgeMap<_Value> Parent;
1.205 - explicit EdgeMap(const GraphAdaptorBase<Graph>& adapter)
1.206 + typedef typename GR::template EdgeMap<V> Parent;
1.207 + explicit EdgeMap(const GraphAdaptorBase<GR>& adapter)
1.208 : Parent(*adapter._graph) {}
1.209 - EdgeMap(const GraphAdaptorBase<Graph>& adapter, const _Value& value)
1.210 + EdgeMap(const GraphAdaptorBase<GR>& adapter, const V& value)
1.211 : Parent(*adapter._graph, value) {}
1.212
1.213 private:
1.214 @@ -314,11 +318,11 @@
1.215
1.216 };
1.217
1.218 - template <typename _Digraph>
1.219 - class ReverseDigraphBase : public DigraphAdaptorBase<_Digraph> {
1.220 + template <typename DGR>
1.221 + class ReverseDigraphBase : public DigraphAdaptorBase<DGR> {
1.222 public:
1.223 - typedef _Digraph Digraph;
1.224 - typedef DigraphAdaptorBase<_Digraph> Parent;
1.225 + typedef DGR Digraph;
1.226 + typedef DigraphAdaptorBase<DGR> Parent;
1.227 protected:
1.228 ReverseDigraphBase() : Parent() { }
1.229 public:
1.230 @@ -336,7 +340,7 @@
1.231
1.232 Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); }
1.233
1.234 - typedef FindArcTagIndicator<Digraph> FindArcTag;
1.235 + typedef FindArcTagIndicator<DGR> FindArcTag;
1.236 Arc findArc(const Node& u, const Node& v,
1.237 const Arc& prev = INVALID) const {
1.238 return Parent::findArc(v, u, prev);
1.239 @@ -356,23 +360,23 @@
1.240 /// by adding or removing nodes or arcs, unless the \c GR template
1.241 /// parameter is set to be \c const.
1.242 ///
1.243 - /// \tparam GR The type of the adapted digraph.
1.244 + /// \tparam DGR The type of the adapted digraph.
1.245 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.246 /// It can also be specified to be \c const.
1.247 ///
1.248 /// \note The \c Node and \c Arc types of this adaptor and the adapted
1.249 /// digraph are convertible to each other.
1.250 - template<typename GR>
1.251 + template<typename DGR>
1.252 #ifdef DOXYGEN
1.253 class ReverseDigraph {
1.254 #else
1.255 class ReverseDigraph :
1.256 - public DigraphAdaptorExtender<ReverseDigraphBase<GR> > {
1.257 + public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > {
1.258 #endif
1.259 public:
1.260 /// The type of the adapted digraph.
1.261 - typedef GR Digraph;
1.262 - typedef DigraphAdaptorExtender<ReverseDigraphBase<GR> > Parent;
1.263 + typedef DGR Digraph;
1.264 + typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;
1.265 protected:
1.266 ReverseDigraph() { }
1.267 public:
1.268 @@ -380,8 +384,8 @@
1.269 /// \brief Constructor
1.270 ///
1.271 /// Creates a reverse digraph adaptor for the given digraph.
1.272 - explicit ReverseDigraph(Digraph& digraph) {
1.273 - Parent::setDigraph(digraph);
1.274 + explicit ReverseDigraph(DGR& digraph) {
1.275 + Parent::initialize(digraph);
1.276 }
1.277 };
1.278
1.279 @@ -390,33 +394,31 @@
1.280 /// This function just returns a read-only \ref ReverseDigraph adaptor.
1.281 /// \ingroup graph_adaptors
1.282 /// \relates ReverseDigraph
1.283 - template<typename GR>
1.284 - ReverseDigraph<const GR> reverseDigraph(const GR& digraph) {
1.285 - return ReverseDigraph<const GR>(digraph);
1.286 + template<typename DGR>
1.287 + ReverseDigraph<const DGR> reverseDigraph(const DGR& digraph) {
1.288 + return ReverseDigraph<const DGR>(digraph);
1.289 }
1.290
1.291
1.292 - template <typename _Digraph, typename _NodeFilterMap,
1.293 - typename _ArcFilterMap, bool _checked = true>
1.294 - class SubDigraphBase : public DigraphAdaptorBase<_Digraph> {
1.295 + template <typename DGR, typename NF, typename AF, bool ch = true>
1.296 + class SubDigraphBase : public DigraphAdaptorBase<DGR> {
1.297 public:
1.298 - typedef _Digraph Digraph;
1.299 - typedef _NodeFilterMap NodeFilterMap;
1.300 - typedef _ArcFilterMap ArcFilterMap;
1.301 + typedef DGR Digraph;
1.302 + typedef NF NodeFilterMap;
1.303 + typedef AF ArcFilterMap;
1.304
1.305 typedef SubDigraphBase Adaptor;
1.306 - typedef DigraphAdaptorBase<_Digraph> Parent;
1.307 + typedef DigraphAdaptorBase<DGR> Parent;
1.308 protected:
1.309 - NodeFilterMap* _node_filter;
1.310 - ArcFilterMap* _arc_filter;
1.311 + NF* _node_filter;
1.312 + AF* _arc_filter;
1.313 SubDigraphBase()
1.314 : Parent(), _node_filter(0), _arc_filter(0) { }
1.315
1.316 - void setNodeFilterMap(NodeFilterMap& node_filter) {
1.317 + void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
1.318 + Parent::initialize(digraph);
1.319 _node_filter = &node_filter;
1.320 - }
1.321 - void setArcFilterMap(ArcFilterMap& arc_filter) {
1.322 - _arc_filter = &arc_filter;
1.323 + _arc_filter = &arc_filter;
1.324 }
1.325
1.326 public:
1.327 @@ -487,7 +489,7 @@
1.328 typedef False NodeNumTag;
1.329 typedef False ArcNumTag;
1.330
1.331 - typedef FindArcTagIndicator<Digraph> FindArcTag;
1.332 + typedef FindArcTagIndicator<DGR> FindArcTag;
1.333 Arc findArc(const Node& source, const Node& target,
1.334 const Arc& prev = INVALID) const {
1.335 if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
1.336 @@ -500,18 +502,21 @@
1.337 return arc;
1.338 }
1.339
1.340 - template <typename _Value>
1.341 - class NodeMap : public SubMapExtender<Adaptor,
1.342 - typename Parent::template NodeMap<_Value> > {
1.343 + public:
1.344 +
1.345 + template <typename V>
1.346 + class NodeMap
1.347 + : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
1.348 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
1.349 public:
1.350 - typedef _Value Value;
1.351 - typedef SubMapExtender<Adaptor, typename Parent::
1.352 - template NodeMap<Value> > MapParent;
1.353 -
1.354 - NodeMap(const Adaptor& adaptor)
1.355 - : MapParent(adaptor) {}
1.356 - NodeMap(const Adaptor& adaptor, const Value& value)
1.357 - : MapParent(adaptor, value) {}
1.358 + typedef V Value;
1.359 + typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
1.360 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
1.361 +
1.362 + NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
1.363 + : Parent(adaptor) {}
1.364 + NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value)
1.365 + : Parent(adaptor, value) {}
1.366
1.367 private:
1.368 NodeMap& operator=(const NodeMap& cmap) {
1.369 @@ -520,23 +525,24 @@
1.370
1.371 template <typename CMap>
1.372 NodeMap& operator=(const CMap& cmap) {
1.373 - MapParent::operator=(cmap);
1.374 + Parent::operator=(cmap);
1.375 return *this;
1.376 }
1.377 };
1.378
1.379 - template <typename _Value>
1.380 - class ArcMap : public SubMapExtender<Adaptor,
1.381 - typename Parent::template ArcMap<_Value> > {
1.382 + template <typename V>
1.383 + class ArcMap
1.384 + : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
1.385 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
1.386 public:
1.387 - typedef _Value Value;
1.388 - typedef SubMapExtender<Adaptor, typename Parent::
1.389 - template ArcMap<Value> > MapParent;
1.390 -
1.391 - ArcMap(const Adaptor& adaptor)
1.392 - : MapParent(adaptor) {}
1.393 - ArcMap(const Adaptor& adaptor, const Value& value)
1.394 - : MapParent(adaptor, value) {}
1.395 + typedef V Value;
1.396 + typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
1.397 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
1.398 +
1.399 + ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
1.400 + : Parent(adaptor) {}
1.401 + ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value)
1.402 + : Parent(adaptor, value) {}
1.403
1.404 private:
1.405 ArcMap& operator=(const ArcMap& cmap) {
1.406 @@ -545,34 +551,33 @@
1.407
1.408 template <typename CMap>
1.409 ArcMap& operator=(const CMap& cmap) {
1.410 - MapParent::operator=(cmap);
1.411 + Parent::operator=(cmap);
1.412 return *this;
1.413 }
1.414 };
1.415
1.416 };
1.417
1.418 - template <typename _Digraph, typename _NodeFilterMap, typename _ArcFilterMap>
1.419 - class SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, false>
1.420 - : public DigraphAdaptorBase<_Digraph> {
1.421 + template <typename DGR, typename NF, typename AF>
1.422 + class SubDigraphBase<DGR, NF, AF, false>
1.423 + : public DigraphAdaptorBase<DGR> {
1.424 public:
1.425 - typedef _Digraph Digraph;
1.426 - typedef _NodeFilterMap NodeFilterMap;
1.427 - typedef _ArcFilterMap ArcFilterMap;
1.428 + typedef DGR Digraph;
1.429 + typedef NF NodeFilterMap;
1.430 + typedef AF ArcFilterMap;
1.431
1.432 typedef SubDigraphBase Adaptor;
1.433 typedef DigraphAdaptorBase<Digraph> Parent;
1.434 protected:
1.435 - NodeFilterMap* _node_filter;
1.436 - ArcFilterMap* _arc_filter;
1.437 + NF* _node_filter;
1.438 + AF* _arc_filter;
1.439 SubDigraphBase()
1.440 : Parent(), _node_filter(0), _arc_filter(0) { }
1.441
1.442 - void setNodeFilterMap(NodeFilterMap& node_filter) {
1.443 + void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
1.444 + Parent::initialize(digraph);
1.445 _node_filter = &node_filter;
1.446 - }
1.447 - void setArcFilterMap(ArcFilterMap& arc_filter) {
1.448 - _arc_filter = &arc_filter;
1.449 + _arc_filter = &arc_filter;
1.450 }
1.451
1.452 public:
1.453 @@ -627,7 +632,7 @@
1.454 typedef False NodeNumTag;
1.455 typedef False ArcNumTag;
1.456
1.457 - typedef FindArcTagIndicator<Digraph> FindArcTag;
1.458 + typedef FindArcTagIndicator<DGR> FindArcTag;
1.459 Arc findArc(const Node& source, const Node& target,
1.460 const Arc& prev = INVALID) const {
1.461 if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
1.462 @@ -640,18 +645,19 @@
1.463 return arc;
1.464 }
1.465
1.466 - template <typename _Value>
1.467 - class NodeMap : public SubMapExtender<Adaptor,
1.468 - typename Parent::template NodeMap<_Value> > {
1.469 + template <typename V>
1.470 + class NodeMap
1.471 + : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
1.472 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
1.473 public:
1.474 - typedef _Value Value;
1.475 - typedef SubMapExtender<Adaptor, typename Parent::
1.476 - template NodeMap<Value> > MapParent;
1.477 -
1.478 - NodeMap(const Adaptor& adaptor)
1.479 - : MapParent(adaptor) {}
1.480 - NodeMap(const Adaptor& adaptor, const Value& value)
1.481 - : MapParent(adaptor, value) {}
1.482 + typedef V Value;
1.483 + typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
1.484 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
1.485 +
1.486 + NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
1.487 + : Parent(adaptor) {}
1.488 + NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value)
1.489 + : Parent(adaptor, value) {}
1.490
1.491 private:
1.492 NodeMap& operator=(const NodeMap& cmap) {
1.493 @@ -660,23 +666,24 @@
1.494
1.495 template <typename CMap>
1.496 NodeMap& operator=(const CMap& cmap) {
1.497 - MapParent::operator=(cmap);
1.498 + Parent::operator=(cmap);
1.499 return *this;
1.500 }
1.501 };
1.502
1.503 - template <typename _Value>
1.504 - class ArcMap : public SubMapExtender<Adaptor,
1.505 - typename Parent::template ArcMap<_Value> > {
1.506 + template <typename V>
1.507 + class ArcMap
1.508 + : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
1.509 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
1.510 public:
1.511 - typedef _Value Value;
1.512 - typedef SubMapExtender<Adaptor, typename Parent::
1.513 - template ArcMap<Value> > MapParent;
1.514 -
1.515 - ArcMap(const Adaptor& adaptor)
1.516 - : MapParent(adaptor) {}
1.517 - ArcMap(const Adaptor& adaptor, const Value& value)
1.518 - : MapParent(adaptor, value) {}
1.519 + typedef V Value;
1.520 + typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
1.521 + LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
1.522 +
1.523 + ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
1.524 + : Parent(adaptor) {}
1.525 + ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value)
1.526 + : Parent(adaptor, value) {}
1.527
1.528 private:
1.529 ArcMap& operator=(const ArcMap& cmap) {
1.530 @@ -685,7 +692,7 @@
1.531
1.532 template <typename CMap>
1.533 ArcMap& operator=(const CMap& cmap) {
1.534 - MapParent::operator=(cmap);
1.535 + Parent::operator=(cmap);
1.536 return *this;
1.537 }
1.538 };
1.539 @@ -708,17 +715,17 @@
1.540 /// by adding or removing nodes or arcs, unless the \c GR template
1.541 /// parameter is set to be \c const.
1.542 ///
1.543 - /// \tparam GR The type of the adapted digraph.
1.544 + /// \tparam DGR The type of the adapted digraph.
1.545 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.546 /// It can also be specified to be \c const.
1.547 /// \tparam NF The type of the node filter map.
1.548 /// It must be a \c bool (or convertible) node map of the
1.549 /// adapted digraph. The default type is
1.550 - /// \ref concepts::Digraph::NodeMap "GR::NodeMap<bool>".
1.551 + /// \ref concepts::Digraph::NodeMap "DGR::NodeMap<bool>".
1.552 /// \tparam AF The type of the arc filter map.
1.553 /// It must be \c bool (or convertible) arc map of the
1.554 /// adapted digraph. The default type is
1.555 - /// \ref concepts::Digraph::ArcMap "GR::ArcMap<bool>".
1.556 + /// \ref concepts::Digraph::ArcMap "DGR::ArcMap<bool>".
1.557 ///
1.558 /// \note The \c Node and \c Arc types of this adaptor and the adapted
1.559 /// digraph are convertible to each other.
1.560 @@ -726,24 +733,24 @@
1.561 /// \see FilterNodes
1.562 /// \see FilterArcs
1.563 #ifdef DOXYGEN
1.564 - template<typename GR, typename NF, typename AF>
1.565 + template<typename DGR, typename NF, typename AF>
1.566 class SubDigraph {
1.567 #else
1.568 - template<typename GR,
1.569 - typename NF = typename GR::template NodeMap<bool>,
1.570 - typename AF = typename GR::template ArcMap<bool> >
1.571 + template<typename DGR,
1.572 + typename NF = typename DGR::template NodeMap<bool>,
1.573 + typename AF = typename DGR::template ArcMap<bool> >
1.574 class SubDigraph :
1.575 - public DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> > {
1.576 + public DigraphAdaptorExtender<SubDigraphBase<DGR, NF, AF, true> > {
1.577 #endif
1.578 public:
1.579 /// The type of the adapted digraph.
1.580 - typedef GR Digraph;
1.581 + typedef DGR Digraph;
1.582 /// The type of the node filter map.
1.583 typedef NF NodeFilterMap;
1.584 /// The type of the arc filter map.
1.585 typedef AF ArcFilterMap;
1.586
1.587 - typedef DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> >
1.588 + typedef DigraphAdaptorExtender<SubDigraphBase<DGR, NF, AF, true> >
1.589 Parent;
1.590
1.591 typedef typename Parent::Node Node;
1.592 @@ -757,11 +764,8 @@
1.593 ///
1.594 /// Creates a subdigraph for the given digraph with the
1.595 /// given node and arc filter maps.
1.596 - SubDigraph(Digraph& digraph, NodeFilterMap& node_filter,
1.597 - ArcFilterMap& arc_filter) {
1.598 - setDigraph(digraph);
1.599 - setNodeFilterMap(node_filter);
1.600 - setArcFilterMap(arc_filter);
1.601 + SubDigraph(DGR& digraph, NF& node_filter, AF& arc_filter) {
1.602 + Parent::initialize(digraph, node_filter, arc_filter);
1.603 }
1.604
1.605 /// \brief Sets the status of the given node
1.606 @@ -823,62 +827,60 @@
1.607 /// This function just returns a read-only \ref SubDigraph adaptor.
1.608 /// \ingroup graph_adaptors
1.609 /// \relates SubDigraph
1.610 - template<typename GR, typename NF, typename AF>
1.611 - SubDigraph<const GR, NF, AF>
1.612 - subDigraph(const GR& digraph,
1.613 - NF& node_filter_map, AF& arc_filter_map) {
1.614 - return SubDigraph<const GR, NF, AF>
1.615 - (digraph, node_filter_map, arc_filter_map);
1.616 + template<typename DGR, typename NF, typename AF>
1.617 + SubDigraph<const DGR, NF, AF>
1.618 + subDigraph(const DGR& digraph,
1.619 + NF& node_filter, AF& arc_filter) {
1.620 + return SubDigraph<const DGR, NF, AF>
1.621 + (digraph, node_filter, arc_filter);
1.622 }
1.623
1.624 - template<typename GR, typename NF, typename AF>
1.625 - SubDigraph<const GR, const NF, AF>
1.626 - subDigraph(const GR& digraph,
1.627 - const NF& node_filter_map, AF& arc_filter_map) {
1.628 - return SubDigraph<const GR, const NF, AF>
1.629 - (digraph, node_filter_map, arc_filter_map);
1.630 + template<typename DGR, typename NF, typename AF>
1.631 + SubDigraph<const DGR, const NF, AF>
1.632 + subDigraph(const DGR& digraph,
1.633 + const NF& node_filter, AF& arc_filter) {
1.634 + return SubDigraph<const DGR, const NF, AF>
1.635 + (digraph, node_filter, arc_filter);
1.636 }
1.637
1.638 - template<typename GR, typename NF, typename AF>
1.639 - SubDigraph<const GR, NF, const AF>
1.640 - subDigraph(const GR& digraph,
1.641 - NF& node_filter_map, const AF& arc_filter_map) {
1.642 - return SubDigraph<const GR, NF, const AF>
1.643 - (digraph, node_filter_map, arc_filter_map);
1.644 + template<typename DGR, typename NF, typename AF>
1.645 + SubDigraph<const DGR, NF, const AF>
1.646 + subDigraph(const DGR& digraph,
1.647 + NF& node_filter, const AF& arc_filter) {
1.648 + return SubDigraph<const DGR, NF, const AF>
1.649 + (digraph, node_filter, arc_filter);
1.650 }
1.651
1.652 - template<typename GR, typename NF, typename AF>
1.653 - SubDigraph<const GR, const NF, const AF>
1.654 - subDigraph(const GR& digraph,
1.655 - const NF& node_filter_map, const AF& arc_filter_map) {
1.656 - return SubDigraph<const GR, const NF, const AF>
1.657 - (digraph, node_filter_map, arc_filter_map);
1.658 + template<typename DGR, typename NF, typename AF>
1.659 + SubDigraph<const DGR, const NF, const AF>
1.660 + subDigraph(const DGR& digraph,
1.661 + const NF& node_filter, const AF& arc_filter) {
1.662 + return SubDigraph<const DGR, const NF, const AF>
1.663 + (digraph, node_filter, arc_filter);
1.664 }
1.665
1.666
1.667 - template <typename _Graph, typename _NodeFilterMap,
1.668 - typename _EdgeFilterMap, bool _checked = true>
1.669 - class SubGraphBase : public GraphAdaptorBase<_Graph> {
1.670 + template <typename GR, typename NF, typename EF, bool ch = true>
1.671 + class SubGraphBase : public GraphAdaptorBase<GR> {
1.672 public:
1.673 - typedef _Graph Graph;
1.674 - typedef _NodeFilterMap NodeFilterMap;
1.675 - typedef _EdgeFilterMap EdgeFilterMap;
1.676 + typedef GR Graph;
1.677 + typedef NF NodeFilterMap;
1.678 + typedef EF EdgeFilterMap;
1.679
1.680 typedef SubGraphBase Adaptor;
1.681 - typedef GraphAdaptorBase<_Graph> Parent;
1.682 + typedef GraphAdaptorBase<GR> Parent;
1.683 protected:
1.684
1.685 - NodeFilterMap* _node_filter_map;
1.686 - EdgeFilterMap* _edge_filter_map;
1.687 + NF* _node_filter;
1.688 + EF* _edge_filter;
1.689
1.690 SubGraphBase()
1.691 - : Parent(), _node_filter_map(0), _edge_filter_map(0) { }
1.692 -
1.693 - void setNodeFilterMap(NodeFilterMap& node_filter_map) {
1.694 - _node_filter_map=&node_filter_map;
1.695 - }
1.696 - void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
1.697 - _edge_filter_map=&edge_filter_map;
1.698 + : Parent(), _node_filter(0), _edge_filter(0) { }
1.699 +
1.700 + void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
1.701 + Parent::initialize(graph);
1.702 + _node_filter = &node_filter;
1.703 + _edge_filter = &edge_filter;
1.704 }
1.705
1.706 public:
1.707 @@ -889,95 +891,95 @@
1.708
1.709 void first(Node& i) const {
1.710 Parent::first(i);
1.711 - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
1.712 + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i);
1.713 }
1.714
1.715 void first(Arc& i) const {
1.716 Parent::first(i);
1.717 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.718 - || !(*_node_filter_map)[Parent::source(i)]
1.719 - || !(*_node_filter_map)[Parent::target(i)]))
1.720 + while (i!=INVALID && (!(*_edge_filter)[i]
1.721 + || !(*_node_filter)[Parent::source(i)]
1.722 + || !(*_node_filter)[Parent::target(i)]))
1.723 Parent::next(i);
1.724 }
1.725
1.726 void first(Edge& i) const {
1.727 Parent::first(i);
1.728 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.729 - || !(*_node_filter_map)[Parent::u(i)]
1.730 - || !(*_node_filter_map)[Parent::v(i)]))
1.731 + while (i!=INVALID && (!(*_edge_filter)[i]
1.732 + || !(*_node_filter)[Parent::u(i)]
1.733 + || !(*_node_filter)[Parent::v(i)]))
1.734 Parent::next(i);
1.735 }
1.736
1.737 void firstIn(Arc& i, const Node& n) const {
1.738 Parent::firstIn(i, n);
1.739 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.740 - || !(*_node_filter_map)[Parent::source(i)]))
1.741 + while (i!=INVALID && (!(*_edge_filter)[i]
1.742 + || !(*_node_filter)[Parent::source(i)]))
1.743 Parent::nextIn(i);
1.744 }
1.745
1.746 void firstOut(Arc& i, const Node& n) const {
1.747 Parent::firstOut(i, n);
1.748 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.749 - || !(*_node_filter_map)[Parent::target(i)]))
1.750 + while (i!=INVALID && (!(*_edge_filter)[i]
1.751 + || !(*_node_filter)[Parent::target(i)]))
1.752 Parent::nextOut(i);
1.753 }
1.754
1.755 void firstInc(Edge& i, bool& d, const Node& n) const {
1.756 Parent::firstInc(i, d, n);
1.757 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.758 - || !(*_node_filter_map)[Parent::u(i)]
1.759 - || !(*_node_filter_map)[Parent::v(i)]))
1.760 + while (i!=INVALID && (!(*_edge_filter)[i]
1.761 + || !(*_node_filter)[Parent::u(i)]
1.762 + || !(*_node_filter)[Parent::v(i)]))
1.763 Parent::nextInc(i, d);
1.764 }
1.765
1.766 void next(Node& i) const {
1.767 Parent::next(i);
1.768 - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
1.769 + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i);
1.770 }
1.771
1.772 void next(Arc& i) const {
1.773 Parent::next(i);
1.774 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.775 - || !(*_node_filter_map)[Parent::source(i)]
1.776 - || !(*_node_filter_map)[Parent::target(i)]))
1.777 + while (i!=INVALID && (!(*_edge_filter)[i]
1.778 + || !(*_node_filter)[Parent::source(i)]
1.779 + || !(*_node_filter)[Parent::target(i)]))
1.780 Parent::next(i);
1.781 }
1.782
1.783 void next(Edge& i) const {
1.784 Parent::next(i);
1.785 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.786 - || !(*_node_filter_map)[Parent::u(i)]
1.787 - || !(*_node_filter_map)[Parent::v(i)]))
1.788 + while (i!=INVALID && (!(*_edge_filter)[i]
1.789 + || !(*_node_filter)[Parent::u(i)]
1.790 + || !(*_node_filter)[Parent::v(i)]))
1.791 Parent::next(i);
1.792 }
1.793
1.794 void nextIn(Arc& i) const {
1.795 Parent::nextIn(i);
1.796 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.797 - || !(*_node_filter_map)[Parent::source(i)]))
1.798 + while (i!=INVALID && (!(*_edge_filter)[i]
1.799 + || !(*_node_filter)[Parent::source(i)]))
1.800 Parent::nextIn(i);
1.801 }
1.802
1.803 void nextOut(Arc& i) const {
1.804 Parent::nextOut(i);
1.805 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.806 - || !(*_node_filter_map)[Parent::target(i)]))
1.807 + while (i!=INVALID && (!(*_edge_filter)[i]
1.808 + || !(*_node_filter)[Parent::target(i)]))
1.809 Parent::nextOut(i);
1.810 }
1.811
1.812 void nextInc(Edge& i, bool& d) const {
1.813 Parent::nextInc(i, d);
1.814 - while (i!=INVALID && (!(*_edge_filter_map)[i]
1.815 - || !(*_node_filter_map)[Parent::u(i)]
1.816 - || !(*_node_filter_map)[Parent::v(i)]))
1.817 + while (i!=INVALID && (!(*_edge_filter)[i]
1.818 + || !(*_node_filter)[Parent::u(i)]
1.819 + || !(*_node_filter)[Parent::v(i)]))
1.820 Parent::nextInc(i, d);
1.821 }
1.822
1.823 - void status(const Node& n, bool v) const { _node_filter_map->set(n, v); }
1.824 - void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); }
1.825 -
1.826 - bool status(const Node& n) const { return (*_node_filter_map)[n]; }
1.827 - bool status(const Edge& e) const { return (*_edge_filter_map)[e]; }
1.828 + void status(const Node& n, bool v) const { _node_filter->set(n, v); }
1.829 + void status(const Edge& e, bool v) const { _edge_filter->set(e, v); }
1.830 +
1.831 + bool status(const Node& n) const { return (*_node_filter)[n]; }
1.832 + bool status(const Edge& e) const { return (*_edge_filter)[e]; }
1.833
1.834 typedef False NodeNumTag;
1.835 typedef False ArcNumTag;
1.836 @@ -986,11 +988,11 @@
1.837 typedef FindArcTagIndicator<Graph> FindArcTag;
1.838 Arc findArc(const Node& u, const Node& v,
1.839 const Arc& prev = INVALID) const {
1.840 - if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
1.841 + if (!(*_node_filter)[u] || !(*_node_filter)[v]) {
1.842 return INVALID;
1.843 }
1.844 Arc arc = Parent::findArc(u, v, prev);
1.845 - while (arc != INVALID && !(*_edge_filter_map)[arc]) {
1.846 + while (arc != INVALID && !(*_edge_filter)[arc]) {
1.847 arc = Parent::findArc(u, v, arc);
1.848 }
1.849 return arc;
1.850 @@ -999,28 +1001,29 @@
1.851 typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
1.852 Edge findEdge(const Node& u, const Node& v,
1.853 const Edge& prev = INVALID) const {
1.854 - if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
1.855 + if (!(*_node_filter)[u] || !(*_node_filter)[v]) {
1.856 return INVALID;
1.857 }
1.858 Edge edge = Parent::findEdge(u, v, prev);
1.859 - while (edge != INVALID && !(*_edge_filter_map)[edge]) {
1.860 + while (edge != INVALID && !(*_edge_filter)[edge]) {
1.861 edge = Parent::findEdge(u, v, edge);
1.862 }
1.863 return edge;
1.864 }
1.865
1.866 - template <typename _Value>
1.867 - class NodeMap : public SubMapExtender<Adaptor,
1.868 - typename Parent::template NodeMap<_Value> > {
1.869 + template <typename V>
1.870 + class NodeMap
1.871 + : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.872 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
1.873 public:
1.874 - typedef _Value Value;
1.875 - typedef SubMapExtender<Adaptor, typename Parent::
1.876 - template NodeMap<Value> > MapParent;
1.877 -
1.878 - NodeMap(const Adaptor& adaptor)
1.879 - : MapParent(adaptor) {}
1.880 - NodeMap(const Adaptor& adaptor, const Value& value)
1.881 - : MapParent(adaptor, value) {}
1.882 + typedef V Value;
1.883 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.884 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
1.885 +
1.886 + NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
1.887 + : Parent(adaptor) {}
1.888 + NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value)
1.889 + : Parent(adaptor, value) {}
1.890
1.891 private:
1.892 NodeMap& operator=(const NodeMap& cmap) {
1.893 @@ -1029,23 +1032,24 @@
1.894
1.895 template <typename CMap>
1.896 NodeMap& operator=(const CMap& cmap) {
1.897 - MapParent::operator=(cmap);
1.898 + Parent::operator=(cmap);
1.899 return *this;
1.900 }
1.901 };
1.902
1.903 - template <typename _Value>
1.904 - class ArcMap : public SubMapExtender<Adaptor,
1.905 - typename Parent::template ArcMap<_Value> > {
1.906 + template <typename V>
1.907 + class ArcMap
1.908 + : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.909 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
1.910 public:
1.911 - typedef _Value Value;
1.912 - typedef SubMapExtender<Adaptor, typename Parent::
1.913 - template ArcMap<Value> > MapParent;
1.914 -
1.915 - ArcMap(const Adaptor& adaptor)
1.916 - : MapParent(adaptor) {}
1.917 - ArcMap(const Adaptor& adaptor, const Value& value)
1.918 - : MapParent(adaptor, value) {}
1.919 + typedef V Value;
1.920 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.921 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
1.922 +
1.923 + ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
1.924 + : Parent(adaptor) {}
1.925 + ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value)
1.926 + : Parent(adaptor, value) {}
1.927
1.928 private:
1.929 ArcMap& operator=(const ArcMap& cmap) {
1.930 @@ -1054,24 +1058,25 @@
1.931
1.932 template <typename CMap>
1.933 ArcMap& operator=(const CMap& cmap) {
1.934 - MapParent::operator=(cmap);
1.935 + Parent::operator=(cmap);
1.936 return *this;
1.937 }
1.938 };
1.939
1.940 - template <typename _Value>
1.941 - class EdgeMap : public SubMapExtender<Adaptor,
1.942 - typename Parent::template EdgeMap<_Value> > {
1.943 + template <typename V>
1.944 + class EdgeMap
1.945 + : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.946 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
1.947 public:
1.948 - typedef _Value Value;
1.949 - typedef SubMapExtender<Adaptor, typename Parent::
1.950 - template EdgeMap<Value> > MapParent;
1.951 -
1.952 - EdgeMap(const Adaptor& adaptor)
1.953 - : MapParent(adaptor) {}
1.954 -
1.955 - EdgeMap(const Adaptor& adaptor, const Value& value)
1.956 - : MapParent(adaptor, value) {}
1.957 + typedef V Value;
1.958 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
1.959 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
1.960 +
1.961 + EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
1.962 + : Parent(adaptor) {}
1.963 +
1.964 + EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value)
1.965 + : Parent(adaptor, value) {}
1.966
1.967 private:
1.968 EdgeMap& operator=(const EdgeMap& cmap) {
1.969 @@ -1080,34 +1085,33 @@
1.970
1.971 template <typename CMap>
1.972 EdgeMap& operator=(const CMap& cmap) {
1.973 - MapParent::operator=(cmap);
1.974 + Parent::operator=(cmap);
1.975 return *this;
1.976 }
1.977 };
1.978
1.979 };
1.980
1.981 - template <typename _Graph, typename _NodeFilterMap, typename _EdgeFilterMap>
1.982 - class SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, false>
1.983 - : public GraphAdaptorBase<_Graph> {
1.984 + template <typename GR, typename NF, typename EF>
1.985 + class SubGraphBase<GR, NF, EF, false>
1.986 + : public GraphAdaptorBase<GR> {
1.987 public:
1.988 - typedef _Graph Graph;
1.989 - typedef _NodeFilterMap NodeFilterMap;
1.990 - typedef _EdgeFilterMap EdgeFilterMap;
1.991 + typedef GR Graph;
1.992 + typedef NF NodeFilterMap;
1.993 + typedef EF EdgeFilterMap;
1.994
1.995 typedef SubGraphBase Adaptor;
1.996 - typedef GraphAdaptorBase<_Graph> Parent;
1.997 + typedef GraphAdaptorBase<GR> Parent;
1.998 protected:
1.999 - NodeFilterMap* _node_filter_map;
1.1000 - EdgeFilterMap* _edge_filter_map;
1.1001 - SubGraphBase() : Parent(),
1.1002 - _node_filter_map(0), _edge_filter_map(0) { }
1.1003 -
1.1004 - void setNodeFilterMap(NodeFilterMap& node_filter_map) {
1.1005 - _node_filter_map=&node_filter_map;
1.1006 - }
1.1007 - void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
1.1008 - _edge_filter_map=&edge_filter_map;
1.1009 + NF* _node_filter;
1.1010 + EF* _edge_filter;
1.1011 + SubGraphBase()
1.1012 + : Parent(), _node_filter(0), _edge_filter(0) { }
1.1013 +
1.1014 + void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
1.1015 + Parent::initialize(graph);
1.1016 + _node_filter = &node_filter;
1.1017 + _edge_filter = &edge_filter;
1.1018 }
1.1019
1.1020 public:
1.1021 @@ -1118,65 +1122,65 @@
1.1022
1.1023 void first(Node& i) const {
1.1024 Parent::first(i);
1.1025 - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
1.1026 + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i);
1.1027 }
1.1028
1.1029 void first(Arc& i) const {
1.1030 Parent::first(i);
1.1031 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
1.1032 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i);
1.1033 }
1.1034
1.1035 void first(Edge& i) const {
1.1036 Parent::first(i);
1.1037 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
1.1038 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i);
1.1039 }
1.1040
1.1041 void firstIn(Arc& i, const Node& n) const {
1.1042 Parent::firstIn(i, n);
1.1043 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i);
1.1044 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i);
1.1045 }
1.1046
1.1047 void firstOut(Arc& i, const Node& n) const {
1.1048 Parent::firstOut(i, n);
1.1049 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i);
1.1050 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i);
1.1051 }
1.1052
1.1053 void firstInc(Edge& i, bool& d, const Node& n) const {
1.1054 Parent::firstInc(i, d, n);
1.1055 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
1.1056 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d);
1.1057 }
1.1058
1.1059 void next(Node& i) const {
1.1060 Parent::next(i);
1.1061 - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i);
1.1062 + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i);
1.1063 }
1.1064 void next(Arc& i) const {
1.1065 Parent::next(i);
1.1066 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
1.1067 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i);
1.1068 }
1.1069 void next(Edge& i) const {
1.1070 Parent::next(i);
1.1071 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i);
1.1072 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i);
1.1073 }
1.1074 void nextIn(Arc& i) const {
1.1075 Parent::nextIn(i);
1.1076 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i);
1.1077 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i);
1.1078 }
1.1079
1.1080 void nextOut(Arc& i) const {
1.1081 Parent::nextOut(i);
1.1082 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i);
1.1083 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i);
1.1084 }
1.1085 void nextInc(Edge& i, bool& d) const {
1.1086 Parent::nextInc(i, d);
1.1087 - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
1.1088 + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d);
1.1089 }
1.1090
1.1091 - void status(const Node& n, bool v) const { _node_filter_map->set(n, v); }
1.1092 - void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); }
1.1093 -
1.1094 - bool status(const Node& n) const { return (*_node_filter_map)[n]; }
1.1095 - bool status(const Edge& e) const { return (*_edge_filter_map)[e]; }
1.1096 + void status(const Node& n, bool v) const { _node_filter->set(n, v); }
1.1097 + void status(const Edge& e, bool v) const { _edge_filter->set(e, v); }
1.1098 +
1.1099 + bool status(const Node& n) const { return (*_node_filter)[n]; }
1.1100 + bool status(const Edge& e) const { return (*_edge_filter)[e]; }
1.1101
1.1102 typedef False NodeNumTag;
1.1103 typedef False ArcNumTag;
1.1104 @@ -1186,7 +1190,7 @@
1.1105 Arc findArc(const Node& u, const Node& v,
1.1106 const Arc& prev = INVALID) const {
1.1107 Arc arc = Parent::findArc(u, v, prev);
1.1108 - while (arc != INVALID && !(*_edge_filter_map)[arc]) {
1.1109 + while (arc != INVALID && !(*_edge_filter)[arc]) {
1.1110 arc = Parent::findArc(u, v, arc);
1.1111 }
1.1112 return arc;
1.1113 @@ -1196,24 +1200,25 @@
1.1114 Edge findEdge(const Node& u, const Node& v,
1.1115 const Edge& prev = INVALID) const {
1.1116 Edge edge = Parent::findEdge(u, v, prev);
1.1117 - while (edge != INVALID && !(*_edge_filter_map)[edge]) {
1.1118 + while (edge != INVALID && !(*_edge_filter)[edge]) {
1.1119 edge = Parent::findEdge(u, v, edge);
1.1120 }
1.1121 return edge;
1.1122 }
1.1123
1.1124 - template <typename _Value>
1.1125 - class NodeMap : public SubMapExtender<Adaptor,
1.1126 - typename Parent::template NodeMap<_Value> > {
1.1127 + template <typename V>
1.1128 + class NodeMap
1.1129 + : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1130 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
1.1131 public:
1.1132 - typedef _Value Value;
1.1133 - typedef SubMapExtender<Adaptor, typename Parent::
1.1134 - template NodeMap<Value> > MapParent;
1.1135 -
1.1136 - NodeMap(const Adaptor& adaptor)
1.1137 - : MapParent(adaptor) {}
1.1138 - NodeMap(const Adaptor& adaptor, const Value& value)
1.1139 - : MapParent(adaptor, value) {}
1.1140 + typedef V Value;
1.1141 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1142 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
1.1143 +
1.1144 + NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
1.1145 + : Parent(adaptor) {}
1.1146 + NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value)
1.1147 + : Parent(adaptor, value) {}
1.1148
1.1149 private:
1.1150 NodeMap& operator=(const NodeMap& cmap) {
1.1151 @@ -1222,23 +1227,24 @@
1.1152
1.1153 template <typename CMap>
1.1154 NodeMap& operator=(const CMap& cmap) {
1.1155 - MapParent::operator=(cmap);
1.1156 + Parent::operator=(cmap);
1.1157 return *this;
1.1158 }
1.1159 };
1.1160
1.1161 - template <typename _Value>
1.1162 - class ArcMap : public SubMapExtender<Adaptor,
1.1163 - typename Parent::template ArcMap<_Value> > {
1.1164 + template <typename V>
1.1165 + class ArcMap
1.1166 + : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1167 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
1.1168 public:
1.1169 - typedef _Value Value;
1.1170 - typedef SubMapExtender<Adaptor, typename Parent::
1.1171 - template ArcMap<Value> > MapParent;
1.1172 -
1.1173 - ArcMap(const Adaptor& adaptor)
1.1174 - : MapParent(adaptor) {}
1.1175 - ArcMap(const Adaptor& adaptor, const Value& value)
1.1176 - : MapParent(adaptor, value) {}
1.1177 + typedef V Value;
1.1178 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1179 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
1.1180 +
1.1181 + ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
1.1182 + : Parent(adaptor) {}
1.1183 + ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value)
1.1184 + : Parent(adaptor, value) {}
1.1185
1.1186 private:
1.1187 ArcMap& operator=(const ArcMap& cmap) {
1.1188 @@ -1247,24 +1253,25 @@
1.1189
1.1190 template <typename CMap>
1.1191 ArcMap& operator=(const CMap& cmap) {
1.1192 - MapParent::operator=(cmap);
1.1193 + Parent::operator=(cmap);
1.1194 return *this;
1.1195 }
1.1196 };
1.1197
1.1198 - template <typename _Value>
1.1199 - class EdgeMap : public SubMapExtender<Adaptor,
1.1200 - typename Parent::template EdgeMap<_Value> > {
1.1201 + template <typename V>
1.1202 + class EdgeMap
1.1203 + : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1204 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
1.1205 public:
1.1206 - typedef _Value Value;
1.1207 - typedef SubMapExtender<Adaptor, typename Parent::
1.1208 - template EdgeMap<Value> > MapParent;
1.1209 -
1.1210 - EdgeMap(const Adaptor& adaptor)
1.1211 - : MapParent(adaptor) {}
1.1212 -
1.1213 - EdgeMap(const Adaptor& adaptor, const _Value& value)
1.1214 - : MapParent(adaptor, value) {}
1.1215 + typedef V Value;
1.1216 + typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
1.1217 + LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
1.1218 +
1.1219 + EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
1.1220 + : Parent(adaptor) {}
1.1221 +
1.1222 + EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value)
1.1223 + : Parent(adaptor, value) {}
1.1224
1.1225 private:
1.1226 EdgeMap& operator=(const EdgeMap& cmap) {
1.1227 @@ -1273,7 +1280,7 @@
1.1228
1.1229 template <typename CMap>
1.1230 EdgeMap& operator=(const CMap& cmap) {
1.1231 - MapParent::operator=(cmap);
1.1232 + Parent::operator=(cmap);
1.1233 return *this;
1.1234 }
1.1235 };
1.1236 @@ -1332,7 +1339,7 @@
1.1237 /// The type of the edge filter map.
1.1238 typedef EF EdgeFilterMap;
1.1239
1.1240 - typedef GraphAdaptorExtender< SubGraphBase<GR, NF, EF, true> >
1.1241 + typedef GraphAdaptorExtender<SubGraphBase<GR, NF, EF, true> >
1.1242 Parent;
1.1243
1.1244 typedef typename Parent::Node Node;
1.1245 @@ -1346,11 +1353,8 @@
1.1246 ///
1.1247 /// Creates a subgraph for the given graph with the given node
1.1248 /// and edge filter maps.
1.1249 - SubGraph(Graph& graph, NodeFilterMap& node_filter_map,
1.1250 - EdgeFilterMap& edge_filter_map) {
1.1251 - setGraph(graph);
1.1252 - setNodeFilterMap(node_filter_map);
1.1253 - setEdgeFilterMap(edge_filter_map);
1.1254 + SubGraph(GR& graph, NF& node_filter, EF& edge_filter) {
1.1255 + initialize(graph, node_filter, edge_filter);
1.1256 }
1.1257
1.1258 /// \brief Sets the status of the given node
1.1259 @@ -1414,34 +1418,30 @@
1.1260 /// \relates SubGraph
1.1261 template<typename GR, typename NF, typename EF>
1.1262 SubGraph<const GR, NF, EF>
1.1263 - subGraph(const GR& graph,
1.1264 - NF& node_filter_map, EF& edge_filter_map) {
1.1265 + subGraph(const GR& graph, NF& node_filter, EF& edge_filter) {
1.1266 return SubGraph<const GR, NF, EF>
1.1267 - (graph, node_filter_map, edge_filter_map);
1.1268 + (graph, node_filter, edge_filter);
1.1269 }
1.1270
1.1271 template<typename GR, typename NF, typename EF>
1.1272 SubGraph<const GR, const NF, EF>
1.1273 - subGraph(const GR& graph,
1.1274 - const NF& node_filter_map, EF& edge_filter_map) {
1.1275 + subGraph(const GR& graph, const NF& node_filter, EF& edge_filter) {
1.1276 return SubGraph<const GR, const NF, EF>
1.1277 - (graph, node_filter_map, edge_filter_map);
1.1278 + (graph, node_filter, edge_filter);
1.1279 }
1.1280
1.1281 template<typename GR, typename NF, typename EF>
1.1282 SubGraph<const GR, NF, const EF>
1.1283 - subGraph(const GR& graph,
1.1284 - NF& node_filter_map, const EF& edge_filter_map) {
1.1285 + subGraph(const GR& graph, NF& node_filter, const EF& edge_filter) {
1.1286 return SubGraph<const GR, NF, const EF>
1.1287 - (graph, node_filter_map, edge_filter_map);
1.1288 + (graph, node_filter, edge_filter);
1.1289 }
1.1290
1.1291 template<typename GR, typename NF, typename EF>
1.1292 SubGraph<const GR, const NF, const EF>
1.1293 - subGraph(const GR& graph,
1.1294 - const NF& node_filter_map, const EF& edge_filter_map) {
1.1295 + subGraph(const GR& graph, const NF& node_filter, const EF& edge_filter) {
1.1296 return SubGraph<const GR, const NF, const EF>
1.1297 - (graph, node_filter_map, edge_filter_map);
1.1298 + (graph, node_filter, edge_filter);
1.1299 }
1.1300
1.1301
1.1302 @@ -1481,7 +1481,8 @@
1.1303 typename Enable = void>
1.1304 class FilterNodes :
1.1305 public DigraphAdaptorExtender<
1.1306 - SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> > {
1.1307 + SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
1.1308 + true> > {
1.1309 #endif
1.1310 public:
1.1311
1.1312 @@ -1489,17 +1490,15 @@
1.1313 typedef NF NodeFilterMap;
1.1314
1.1315 typedef DigraphAdaptorExtender<
1.1316 - SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> >
1.1317 - Parent;
1.1318 + SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
1.1319 + true> > Parent;
1.1320
1.1321 typedef typename Parent::Node Node;
1.1322
1.1323 protected:
1.1324 - ConstMap<typename Digraph::Arc, bool> const_true_map;
1.1325 -
1.1326 - FilterNodes() : const_true_map(true) {
1.1327 - Parent::setArcFilterMap(const_true_map);
1.1328 - }
1.1329 + ConstMap<typename Digraph::Arc, Const<bool, true> > const_true_map;
1.1330 +
1.1331 + FilterNodes() : const_true_map() {}
1.1332
1.1333 public:
1.1334
1.1335 @@ -1507,12 +1506,10 @@
1.1336 ///
1.1337 /// Creates a subgraph for the given digraph or graph with the
1.1338 /// given node filter map.
1.1339 - FilterNodes(GR& graph, NodeFilterMap& node_filter) :
1.1340 - Parent(), const_true_map(true)
1.1341 + FilterNodes(GR& graph, NF& node_filter)
1.1342 + : Parent(), const_true_map()
1.1343 {
1.1344 - Parent::setDigraph(graph);
1.1345 - Parent::setNodeFilterMap(node_filter);
1.1346 - Parent::setArcFilterMap(const_true_map);
1.1347 + Parent::initialize(graph, node_filter, const_true_map);
1.1348 }
1.1349
1.1350 /// \brief Sets the status of the given node
1.1351 @@ -1547,30 +1544,27 @@
1.1352 class FilterNodes<GR, NF,
1.1353 typename enable_if<UndirectedTagIndicator<GR> >::type> :
1.1354 public GraphAdaptorExtender<
1.1355 - SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> > {
1.1356 + SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
1.1357 + true> > {
1.1358
1.1359 public:
1.1360 typedef GR Graph;
1.1361 typedef NF NodeFilterMap;
1.1362 typedef GraphAdaptorExtender<
1.1363 - SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> >
1.1364 - Parent;
1.1365 + SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
1.1366 + true> > Parent;
1.1367
1.1368 typedef typename Parent::Node Node;
1.1369 protected:
1.1370 - ConstMap<typename Graph::Edge, bool> const_true_map;
1.1371 -
1.1372 - FilterNodes() : const_true_map(true) {
1.1373 - Parent::setEdgeFilterMap(const_true_map);
1.1374 - }
1.1375 + ConstMap<typename GR::Edge, Const<bool, true> > const_true_map;
1.1376 +
1.1377 + FilterNodes() : const_true_map() {}
1.1378
1.1379 public:
1.1380
1.1381 - FilterNodes(Graph& _graph, NodeFilterMap& node_filter_map) :
1.1382 - Parent(), const_true_map(true) {
1.1383 - Parent::setGraph(_graph);
1.1384 - Parent::setNodeFilterMap(node_filter_map);
1.1385 - Parent::setEdgeFilterMap(const_true_map);
1.1386 + FilterNodes(GR& graph, NodeFilterMap& node_filter) :
1.1387 + Parent(), const_true_map() {
1.1388 + Parent::initialize(graph, node_filter, const_true_map);
1.1389 }
1.1390
1.1391 void status(const Node& n, bool v) const { Parent::status(n, v); }
1.1392 @@ -1588,14 +1582,14 @@
1.1393 /// \relates FilterNodes
1.1394 template<typename GR, typename NF>
1.1395 FilterNodes<const GR, NF>
1.1396 - filterNodes(const GR& graph, NF& node_filter_map) {
1.1397 - return FilterNodes<const GR, NF>(graph, node_filter_map);
1.1398 + filterNodes(const GR& graph, NF& node_filter) {
1.1399 + return FilterNodes<const GR, NF>(graph, node_filter);
1.1400 }
1.1401
1.1402 template<typename GR, typename NF>
1.1403 FilterNodes<const GR, const NF>
1.1404 - filterNodes(const GR& graph, const NF& node_filter_map) {
1.1405 - return FilterNodes<const GR, const NF>(graph, node_filter_map);
1.1406 + filterNodes(const GR& graph, const NF& node_filter) {
1.1407 + return FilterNodes<const GR, const NF>(graph, node_filter);
1.1408 }
1.1409
1.1410 /// \ingroup graph_adaptors
1.1411 @@ -1612,45 +1606,44 @@
1.1412 /// by adding or removing nodes or arcs, unless the \c GR template
1.1413 /// parameter is set to be \c const.
1.1414 ///
1.1415 - /// \tparam GR The type of the adapted digraph.
1.1416 + /// \tparam DGR The type of the adapted digraph.
1.1417 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.1418 /// It can also be specified to be \c const.
1.1419 /// \tparam AF The type of the arc filter map.
1.1420 /// It must be a \c bool (or convertible) arc map of the
1.1421 /// adapted digraph. The default type is
1.1422 - /// \ref concepts::Digraph::ArcMap "GR::ArcMap<bool>".
1.1423 + /// \ref concepts::Digraph::ArcMap "DGR::ArcMap<bool>".
1.1424 ///
1.1425 /// \note The \c Node and \c Arc types of this adaptor and the adapted
1.1426 /// digraph are convertible to each other.
1.1427 #ifdef DOXYGEN
1.1428 - template<typename GR,
1.1429 + template<typename DGR,
1.1430 typename AF>
1.1431 class FilterArcs {
1.1432 #else
1.1433 - template<typename GR,
1.1434 - typename AF = typename GR::template ArcMap<bool> >
1.1435 + template<typename DGR,
1.1436 + typename AF = typename DGR::template ArcMap<bool> >
1.1437 class FilterArcs :
1.1438 public DigraphAdaptorExtender<
1.1439 - SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> > {
1.1440 + SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
1.1441 + AF, false> > {
1.1442 #endif
1.1443 public:
1.1444 /// The type of the adapted digraph.
1.1445 - typedef GR Digraph;
1.1446 + typedef DGR Digraph;
1.1447 /// The type of the arc filter map.
1.1448 typedef AF ArcFilterMap;
1.1449
1.1450 typedef DigraphAdaptorExtender<
1.1451 - SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> >
1.1452 - Parent;
1.1453 + SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
1.1454 + AF, false> > Parent;
1.1455
1.1456 typedef typename Parent::Arc Arc;
1.1457
1.1458 protected:
1.1459 - ConstMap<typename Digraph::Node, bool> const_true_map;
1.1460 -
1.1461 - FilterArcs() : const_true_map(true) {
1.1462 - Parent::setNodeFilterMap(const_true_map);
1.1463 - }
1.1464 + ConstMap<typename DGR::Node, Const<bool, true> > const_true_map;
1.1465 +
1.1466 + FilterArcs() : const_true_map() {}
1.1467
1.1468 public:
1.1469
1.1470 @@ -1658,11 +1651,9 @@
1.1471 ///
1.1472 /// Creates a subdigraph for the given digraph with the given arc
1.1473 /// filter map.
1.1474 - FilterArcs(Digraph& digraph, ArcFilterMap& arc_filter)
1.1475 - : Parent(), const_true_map(true) {
1.1476 - Parent::setDigraph(digraph);
1.1477 - Parent::setNodeFilterMap(const_true_map);
1.1478 - Parent::setArcFilterMap(arc_filter);
1.1479 + FilterArcs(DGR& digraph, ArcFilterMap& arc_filter)
1.1480 + : Parent(), const_true_map() {
1.1481 + Parent::initialize(digraph, const_true_map, arc_filter);
1.1482 }
1.1483
1.1484 /// \brief Sets the status of the given arc
1.1485 @@ -1698,16 +1689,16 @@
1.1486 /// This function just returns a read-only \ref FilterArcs adaptor.
1.1487 /// \ingroup graph_adaptors
1.1488 /// \relates FilterArcs
1.1489 - template<typename GR, typename AF>
1.1490 - FilterArcs<const GR, AF>
1.1491 - filterArcs(const GR& digraph, AF& arc_filter_map) {
1.1492 - return FilterArcs<const GR, AF>(digraph, arc_filter_map);
1.1493 + template<typename DGR, typename AF>
1.1494 + FilterArcs<const DGR, AF>
1.1495 + filterArcs(const DGR& digraph, AF& arc_filter) {
1.1496 + return FilterArcs<const DGR, AF>(digraph, arc_filter);
1.1497 }
1.1498
1.1499 - template<typename GR, typename AF>
1.1500 - FilterArcs<const GR, const AF>
1.1501 - filterArcs(const GR& digraph, const AF& arc_filter_map) {
1.1502 - return FilterArcs<const GR, const AF>(digraph, arc_filter_map);
1.1503 + template<typename DGR, typename AF>
1.1504 + FilterArcs<const DGR, const AF>
1.1505 + filterArcs(const DGR& digraph, const AF& arc_filter) {
1.1506 + return FilterArcs<const DGR, const AF>(digraph, arc_filter);
1.1507 }
1.1508
1.1509 /// \ingroup graph_adaptors
1.1510 @@ -1743,7 +1734,8 @@
1.1511 typename EF = typename GR::template EdgeMap<bool> >
1.1512 class FilterEdges :
1.1513 public GraphAdaptorExtender<
1.1514 - SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> > {
1.1515 + SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >,
1.1516 + EF, false> > {
1.1517 #endif
1.1518 public:
1.1519 /// The type of the adapted graph.
1.1520 @@ -1752,13 +1744,13 @@
1.1521 typedef EF EdgeFilterMap;
1.1522
1.1523 typedef GraphAdaptorExtender<
1.1524 - SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> >
1.1525 - Parent;
1.1526 + SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
1.1527 + EF, false> > Parent;
1.1528
1.1529 typedef typename Parent::Edge Edge;
1.1530
1.1531 protected:
1.1532 - ConstMap<typename Graph::Node, bool> const_true_map;
1.1533 + ConstMap<typename GR::Node, Const<bool, true> > const_true_map;
1.1534
1.1535 FilterEdges() : const_true_map(true) {
1.1536 Parent::setNodeFilterMap(const_true_map);
1.1537 @@ -1770,11 +1762,9 @@
1.1538 ///
1.1539 /// Creates a subgraph for the given graph with the given edge
1.1540 /// filter map.
1.1541 - FilterEdges(Graph& graph, EdgeFilterMap& edge_filter_map) :
1.1542 - Parent(), const_true_map(true) {
1.1543 - Parent::setGraph(graph);
1.1544 - Parent::setNodeFilterMap(const_true_map);
1.1545 - Parent::setEdgeFilterMap(edge_filter_map);
1.1546 + FilterEdges(GR& graph, EF& edge_filter)
1.1547 + : Parent(), const_true_map() {
1.1548 + Parent::initialize(graph, const_true_map, edge_filter);
1.1549 }
1.1550
1.1551 /// \brief Sets the status of the given edge
1.1552 @@ -1812,21 +1802,21 @@
1.1553 /// \relates FilterEdges
1.1554 template<typename GR, typename EF>
1.1555 FilterEdges<const GR, EF>
1.1556 - filterEdges(const GR& graph, EF& edge_filter_map) {
1.1557 - return FilterEdges<const GR, EF>(graph, edge_filter_map);
1.1558 + filterEdges(const GR& graph, EF& edge_filter) {
1.1559 + return FilterEdges<const GR, EF>(graph, edge_filter);
1.1560 }
1.1561
1.1562 template<typename GR, typename EF>
1.1563 FilterEdges<const GR, const EF>
1.1564 - filterEdges(const GR& graph, const EF& edge_filter_map) {
1.1565 - return FilterEdges<const GR, const EF>(graph, edge_filter_map);
1.1566 + filterEdges(const GR& graph, const EF& edge_filter) {
1.1567 + return FilterEdges<const GR, const EF>(graph, edge_filter);
1.1568 }
1.1569
1.1570
1.1571 - template <typename _Digraph>
1.1572 + template <typename DGR>
1.1573 class UndirectorBase {
1.1574 public:
1.1575 - typedef _Digraph Digraph;
1.1576 + typedef DGR Digraph;
1.1577 typedef UndirectorBase Adaptor;
1.1578
1.1579 typedef True UndirectedTag;
1.1580 @@ -2062,34 +2052,35 @@
1.1581
1.1582 private:
1.1583
1.1584 - template <typename _Value>
1.1585 + template <typename V>
1.1586 class ArcMapBase {
1.1587 private:
1.1588
1.1589 - typedef typename Digraph::template ArcMap<_Value> MapImpl;
1.1590 + typedef typename DGR::template ArcMap<V> MapImpl;
1.1591
1.1592 public:
1.1593
1.1594 typedef typename MapTraits<MapImpl>::ReferenceMapTag ReferenceMapTag;
1.1595
1.1596 - typedef _Value Value;
1.1597 + typedef V Value;
1.1598 typedef Arc Key;
1.1599 typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReturnValue;
1.1600 typedef typename MapTraits<MapImpl>::ReturnValue ReturnValue;
1.1601 typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReference;
1.1602 typedef typename MapTraits<MapImpl>::ReturnValue Reference;
1.1603
1.1604 - ArcMapBase(const Adaptor& adaptor) :
1.1605 + ArcMapBase(const UndirectorBase<DGR>& adaptor) :
1.1606 _forward(*adaptor._digraph), _backward(*adaptor._digraph) {}
1.1607
1.1608 - ArcMapBase(const Adaptor& adaptor, const Value& v)
1.1609 - : _forward(*adaptor._digraph, v), _backward(*adaptor._digraph, v) {}
1.1610 -
1.1611 - void set(const Arc& a, const Value& v) {
1.1612 + ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value)
1.1613 + : _forward(*adaptor._digraph, value),
1.1614 + _backward(*adaptor._digraph, value) {}
1.1615 +
1.1616 + void set(const Arc& a, const V& value) {
1.1617 if (direction(a)) {
1.1618 - _forward.set(a, v);
1.1619 + _forward.set(a, value);
1.1620 } else {
1.1621 - _backward.set(a, v);
1.1622 + _backward.set(a, value);
1.1623 }
1.1624 }
1.1625
1.1626 @@ -2117,17 +2108,17 @@
1.1627
1.1628 public:
1.1629
1.1630 - template <typename _Value>
1.1631 - class NodeMap : public Digraph::template NodeMap<_Value> {
1.1632 + template <typename V>
1.1633 + class NodeMap : public DGR::template NodeMap<V> {
1.1634 public:
1.1635
1.1636 - typedef _Value Value;
1.1637 - typedef typename Digraph::template NodeMap<Value> Parent;
1.1638 -
1.1639 - explicit NodeMap(const Adaptor& adaptor)
1.1640 + typedef V Value;
1.1641 + typedef typename DGR::template NodeMap<Value> Parent;
1.1642 +
1.1643 + explicit NodeMap(const UndirectorBase<DGR>& adaptor)
1.1644 : Parent(*adaptor._digraph) {}
1.1645
1.1646 - NodeMap(const Adaptor& adaptor, const _Value& value)
1.1647 + NodeMap(const UndirectorBase<DGR>& adaptor, const V& value)
1.1648 : Parent(*adaptor._digraph, value) { }
1.1649
1.1650 private:
1.1651 @@ -2143,18 +2134,18 @@
1.1652
1.1653 };
1.1654
1.1655 - template <typename _Value>
1.1656 + template <typename V>
1.1657 class ArcMap
1.1658 - : public SubMapExtender<Adaptor, ArcMapBase<_Value> >
1.1659 + : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> >
1.1660 {
1.1661 public:
1.1662 - typedef _Value Value;
1.1663 - typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent;
1.1664 -
1.1665 - explicit ArcMap(const Adaptor& adaptor)
1.1666 + typedef V Value;
1.1667 + typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent;
1.1668 +
1.1669 + explicit ArcMap(const UndirectorBase<DGR>& adaptor)
1.1670 : Parent(adaptor) {}
1.1671
1.1672 - ArcMap(const Adaptor& adaptor, const Value& value)
1.1673 + ArcMap(const UndirectorBase<DGR>& adaptor, const V& value)
1.1674 : Parent(adaptor, value) {}
1.1675
1.1676 private:
1.1677 @@ -2169,17 +2160,17 @@
1.1678 }
1.1679 };
1.1680
1.1681 - template <typename _Value>
1.1682 - class EdgeMap : public Digraph::template ArcMap<_Value> {
1.1683 + template <typename V>
1.1684 + class EdgeMap : public Digraph::template ArcMap<V> {
1.1685 public:
1.1686
1.1687 - typedef _Value Value;
1.1688 - typedef typename Digraph::template ArcMap<Value> Parent;
1.1689 -
1.1690 - explicit EdgeMap(const Adaptor& adaptor)
1.1691 + typedef V Value;
1.1692 + typedef typename Digraph::template ArcMap<V> Parent;
1.1693 +
1.1694 + explicit EdgeMap(const UndirectorBase<DGR>& adaptor)
1.1695 : Parent(*adaptor._digraph) {}
1.1696
1.1697 - EdgeMap(const Adaptor& adaptor, const Value& value)
1.1698 + EdgeMap(const UndirectorBase<DGR>& adaptor, const V& value)
1.1699 : Parent(*adaptor._digraph, value) {}
1.1700
1.1701 private:
1.1702 @@ -2195,19 +2186,19 @@
1.1703
1.1704 };
1.1705
1.1706 - typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
1.1707 + typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier;
1.1708 NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
1.1709
1.1710 - typedef typename ItemSetTraits<Digraph, Edge>::ItemNotifier EdgeNotifier;
1.1711 + typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
1.1712 EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
1.1713
1.1714 protected:
1.1715
1.1716 UndirectorBase() : _digraph(0) {}
1.1717
1.1718 - Digraph* _digraph;
1.1719 -
1.1720 - void setDigraph(Digraph& digraph) {
1.1721 + DGR* _digraph;
1.1722 +
1.1723 + void initialize(DGR& digraph) {
1.1724 _digraph = &digraph;
1.1725 }
1.1726
1.1727 @@ -2226,7 +2217,7 @@
1.1728 /// by adding or removing nodes or edges, unless the \c GR template
1.1729 /// parameter is set to be \c const.
1.1730 ///
1.1731 - /// \tparam GR The type of the adapted digraph.
1.1732 + /// \tparam DGR The type of the adapted digraph.
1.1733 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.1734 /// It can also be specified to be \c const.
1.1735 ///
1.1736 @@ -2236,17 +2227,17 @@
1.1737 /// each other.
1.1738 /// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type
1.1739 /// of the adapted digraph.)
1.1740 - template<typename GR>
1.1741 + template<typename DGR>
1.1742 #ifdef DOXYGEN
1.1743 class Undirector {
1.1744 #else
1.1745 class Undirector :
1.1746 - public GraphAdaptorExtender<UndirectorBase<GR> > {
1.1747 + public GraphAdaptorExtender<UndirectorBase<DGR> > {
1.1748 #endif
1.1749 public:
1.1750 /// The type of the adapted digraph.
1.1751 - typedef GR Digraph;
1.1752 - typedef GraphAdaptorExtender<UndirectorBase<GR> > Parent;
1.1753 + typedef DGR Digraph;
1.1754 + typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;
1.1755 protected:
1.1756 Undirector() { }
1.1757 public:
1.1758 @@ -2254,8 +2245,8 @@
1.1759 /// \brief Constructor
1.1760 ///
1.1761 /// Creates an undirected graph from the given digraph.
1.1762 - Undirector(Digraph& digraph) {
1.1763 - setDigraph(digraph);
1.1764 + Undirector(DGR& digraph) {
1.1765 + initialize(digraph);
1.1766 }
1.1767
1.1768 /// \brief Arc map combined from two original arc maps
1.1769 @@ -2355,21 +2346,21 @@
1.1770 /// This function just returns a read-only \ref Undirector adaptor.
1.1771 /// \ingroup graph_adaptors
1.1772 /// \relates Undirector
1.1773 - template<typename GR>
1.1774 - Undirector<const GR> undirector(const GR& digraph) {
1.1775 - return Undirector<const GR>(digraph);
1.1776 + template<typename DGR>
1.1777 + Undirector<const DGR> undirector(const DGR& digraph) {
1.1778 + return Undirector<const DGR>(digraph);
1.1779 }
1.1780
1.1781
1.1782 - template <typename _Graph, typename _DirectionMap>
1.1783 + template <typename GR, typename DM>
1.1784 class OrienterBase {
1.1785 public:
1.1786
1.1787 - typedef _Graph Graph;
1.1788 - typedef _DirectionMap DirectionMap;
1.1789 -
1.1790 - typedef typename Graph::Node Node;
1.1791 - typedef typename Graph::Edge Arc;
1.1792 + typedef GR Graph;
1.1793 + typedef DM DirectionMap;
1.1794 +
1.1795 + typedef typename GR::Node Node;
1.1796 + typedef typename GR::Edge Arc;
1.1797
1.1798 void reverseArc(const Arc& arc) {
1.1799 _direction->set(arc, !(*_direction)[arc]);
1.1800 @@ -2448,22 +2439,22 @@
1.1801 int maxNodeId() const { return _graph->maxNodeId(); }
1.1802 int maxArcId() const { return _graph->maxEdgeId(); }
1.1803
1.1804 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
1.1805 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
1.1806 NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
1.1807
1.1808 - typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
1.1809 + typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier;
1.1810 ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
1.1811
1.1812 - template <typename _Value>
1.1813 - class NodeMap : public _Graph::template NodeMap<_Value> {
1.1814 + template <typename V>
1.1815 + class NodeMap : public GR::template NodeMap<V> {
1.1816 public:
1.1817
1.1818 - typedef typename _Graph::template NodeMap<_Value> Parent;
1.1819 -
1.1820 - explicit NodeMap(const OrienterBase& adapter)
1.1821 + typedef typename GR::template NodeMap<V> Parent;
1.1822 +
1.1823 + explicit NodeMap(const OrienterBase<GR, DM>& adapter)
1.1824 : Parent(*adapter._graph) {}
1.1825
1.1826 - NodeMap(const OrienterBase& adapter, const _Value& value)
1.1827 + NodeMap(const OrienterBase<GR, DM>& adapter, const V& value)
1.1828 : Parent(*adapter._graph, value) {}
1.1829
1.1830 private:
1.1831 @@ -2479,16 +2470,16 @@
1.1832
1.1833 };
1.1834
1.1835 - template <typename _Value>
1.1836 - class ArcMap : public _Graph::template EdgeMap<_Value> {
1.1837 + template <typename V>
1.1838 + class ArcMap : public GR::template EdgeMap<V> {
1.1839 public:
1.1840
1.1841 - typedef typename Graph::template EdgeMap<_Value> Parent;
1.1842 -
1.1843 - explicit ArcMap(const OrienterBase& adapter)
1.1844 + typedef typename Graph::template EdgeMap<V> Parent;
1.1845 +
1.1846 + explicit ArcMap(const OrienterBase<GR, DM>& adapter)
1.1847 : Parent(*adapter._graph) { }
1.1848
1.1849 - ArcMap(const OrienterBase& adapter, const _Value& value)
1.1850 + ArcMap(const OrienterBase<GR, DM>& adapter, const V& value)
1.1851 : Parent(*adapter._graph, value) { }
1.1852
1.1853 private:
1.1854 @@ -2507,16 +2498,13 @@
1.1855
1.1856 protected:
1.1857 Graph* _graph;
1.1858 - DirectionMap* _direction;
1.1859 -
1.1860 - void setDirectionMap(DirectionMap& direction) {
1.1861 + DM* _direction;
1.1862 +
1.1863 + void initialize(GR& graph, DM& direction) {
1.1864 + _graph = &graph;
1.1865 _direction = &direction;
1.1866 }
1.1867
1.1868 - void setGraph(Graph& graph) {
1.1869 - _graph = &graph;
1.1870 - }
1.1871 -
1.1872 };
1.1873
1.1874 /// \ingroup graph_adaptors
1.1875 @@ -2572,9 +2560,8 @@
1.1876 /// \brief Constructor
1.1877 ///
1.1878 /// Constructor of the adaptor.
1.1879 - Orienter(Graph& graph, DirectionMap& direction) {
1.1880 - setGraph(graph);
1.1881 - setDirectionMap(direction);
1.1882 + Orienter(GR& graph, DM& direction) {
1.1883 + Parent::initialize(graph, direction);
1.1884 }
1.1885
1.1886 /// \brief Reverses the given arc
1.1887 @@ -2594,67 +2581,62 @@
1.1888 /// \relates Orienter
1.1889 template<typename GR, typename DM>
1.1890 Orienter<const GR, DM>
1.1891 - orienter(const GR& graph, DM& direction_map) {
1.1892 - return Orienter<const GR, DM>(graph, direction_map);
1.1893 + orienter(const GR& graph, DM& direction) {
1.1894 + return Orienter<const GR, DM>(graph, direction);
1.1895 }
1.1896
1.1897 template<typename GR, typename DM>
1.1898 Orienter<const GR, const DM>
1.1899 - orienter(const GR& graph, const DM& direction_map) {
1.1900 - return Orienter<const GR, const DM>(graph, direction_map);
1.1901 + orienter(const GR& graph, const DM& direction) {
1.1902 + return Orienter<const GR, const DM>(graph, direction);
1.1903 }
1.1904
1.1905 namespace _adaptor_bits {
1.1906
1.1907 - template<typename Digraph,
1.1908 - typename CapacityMap,
1.1909 - typename FlowMap,
1.1910 - typename Tolerance>
1.1911 + template <typename DGR, typename CM, typename FM, typename TL>
1.1912 class ResForwardFilter {
1.1913 public:
1.1914
1.1915 - typedef typename Digraph::Arc Key;
1.1916 + typedef typename DGR::Arc Key;
1.1917 typedef bool Value;
1.1918
1.1919 private:
1.1920
1.1921 - const CapacityMap* _capacity;
1.1922 - const FlowMap* _flow;
1.1923 - Tolerance _tolerance;
1.1924 + const CM* _capacity;
1.1925 + const FM* _flow;
1.1926 + TL _tolerance;
1.1927 +
1.1928 public:
1.1929
1.1930 - ResForwardFilter(const CapacityMap& capacity, const FlowMap& flow,
1.1931 - const Tolerance& tolerance = Tolerance())
1.1932 + ResForwardFilter(const CM& capacity, const FM& flow,
1.1933 + const TL& tolerance = TL())
1.1934 : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
1.1935
1.1936 - bool operator[](const typename Digraph::Arc& a) const {
1.1937 + bool operator[](const typename DGR::Arc& a) const {
1.1938 return _tolerance.positive((*_capacity)[a] - (*_flow)[a]);
1.1939 }
1.1940 };
1.1941
1.1942 - template<typename Digraph,
1.1943 - typename CapacityMap,
1.1944 - typename FlowMap,
1.1945 - typename Tolerance>
1.1946 + template<typename DGR,typename CM, typename FM, typename TL>
1.1947 class ResBackwardFilter {
1.1948 public:
1.1949
1.1950 - typedef typename Digraph::Arc Key;
1.1951 + typedef typename DGR::Arc Key;
1.1952 typedef bool Value;
1.1953
1.1954 private:
1.1955
1.1956 - const CapacityMap* _capacity;
1.1957 - const FlowMap* _flow;
1.1958 - Tolerance _tolerance;
1.1959 + const CM* _capacity;
1.1960 + const FM* _flow;
1.1961 + TL _tolerance;
1.1962
1.1963 public:
1.1964
1.1965 - ResBackwardFilter(const CapacityMap& capacity, const FlowMap& flow,
1.1966 - const Tolerance& tolerance = Tolerance())
1.1967 + ResBackwardFilter(const CM& capacity, const FM& flow,
1.1968 + const TL& tolerance = TL())
1.1969 : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
1.1970
1.1971 - bool operator[](const typename Digraph::Arc& a) const {
1.1972 + bool operator[](const typename DGR::Arc& a) const {
1.1973 return _tolerance.positive((*_flow)[a]);
1.1974 }
1.1975 };
1.1976 @@ -2681,7 +2663,7 @@
1.1977 /// arcs).
1.1978 /// This class conforms to the \ref concepts::Digraph "Digraph" concept.
1.1979 ///
1.1980 - /// \tparam GR The type of the adapted digraph.
1.1981 + /// \tparam DGR The type of the adapted digraph.
1.1982 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.1983 /// It is implicitly \c const.
1.1984 /// \tparam CM The type of the capacity map.
1.1985 @@ -2703,25 +2685,26 @@
1.1986 /// convertible to each other, moreover the \c Arc type of the adaptor
1.1987 /// is convertible to the \c Arc type of the adapted digraph.
1.1988 #ifdef DOXYGEN
1.1989 - template<typename GR, typename CM, typename FM, typename TL>
1.1990 + template<typename DGR, typename CM, typename FM, typename TL>
1.1991 class ResidualDigraph
1.1992 #else
1.1993 - template<typename GR,
1.1994 - typename CM = typename GR::template ArcMap<int>,
1.1995 + template<typename DGR,
1.1996 + typename CM = typename DGR::template ArcMap<int>,
1.1997 typename FM = CM,
1.1998 typename TL = Tolerance<typename CM::Value> >
1.1999 - class ResidualDigraph :
1.2000 - public FilterArcs<
1.2001 - Undirector<const GR>,
1.2002 - typename Undirector<const GR>::template CombinedArcMap<
1.2003 - _adaptor_bits::ResForwardFilter<const GR, CM, FM, TL>,
1.2004 - _adaptor_bits::ResBackwardFilter<const GR, CM, FM, TL> > >
1.2005 + class ResidualDigraph
1.2006 + : public SubDigraph<
1.2007 + Undirector<const DGR>,
1.2008 + ConstMap<typename DGR::Node, Const<bool, true> >,
1.2009 + typename Undirector<const DGR>::template CombinedArcMap<
1.2010 + _adaptor_bits::ResForwardFilter<const DGR, CM, FM, TL>,
1.2011 + _adaptor_bits::ResBackwardFilter<const DGR, CM, FM, TL> > >
1.2012 #endif
1.2013 {
1.2014 public:
1.2015
1.2016 /// The type of the underlying digraph.
1.2017 - typedef GR Digraph;
1.2018 + typedef DGR Digraph;
1.2019 /// The type of the capacity map.
1.2020 typedef CM CapacityMap;
1.2021 /// The type of the flow map.
1.2022 @@ -2736,21 +2719,24 @@
1.2023
1.2024 typedef Undirector<const Digraph> Undirected;
1.2025
1.2026 - typedef _adaptor_bits::ResForwardFilter<const Digraph, CapacityMap,
1.2027 - FlowMap, Tolerance> ForwardFilter;
1.2028 -
1.2029 - typedef _adaptor_bits::ResBackwardFilter<const Digraph, CapacityMap,
1.2030 - FlowMap, Tolerance> BackwardFilter;
1.2031 + typedef ConstMap<typename DGR::Node, Const<bool, true> > NodeFilter;
1.2032 +
1.2033 + typedef _adaptor_bits::ResForwardFilter<const DGR, CM,
1.2034 + FM, TL> ForwardFilter;
1.2035 +
1.2036 + typedef _adaptor_bits::ResBackwardFilter<const DGR, CM,
1.2037 + FM, TL> BackwardFilter;
1.2038
1.2039 typedef typename Undirected::
1.2040 template CombinedArcMap<ForwardFilter, BackwardFilter> ArcFilter;
1.2041
1.2042 - typedef FilterArcs<Undirected, ArcFilter> Parent;
1.2043 + typedef SubDigraph<Undirected, NodeFilter, ArcFilter> Parent;
1.2044
1.2045 const CapacityMap* _capacity;
1.2046 FlowMap* _flow;
1.2047
1.2048 Undirected _graph;
1.2049 + NodeFilter _node_filter;
1.2050 ForwardFilter _forward_filter;
1.2051 BackwardFilter _backward_filter;
1.2052 ArcFilter _arc_filter;
1.2053 @@ -2761,15 +2747,15 @@
1.2054 ///
1.2055 /// Constructor of the residual digraph adaptor. The parameters are the
1.2056 /// digraph, the capacity map, the flow map, and a tolerance object.
1.2057 - ResidualDigraph(const Digraph& digraph, const CapacityMap& capacity,
1.2058 - FlowMap& flow, const Tolerance& tolerance = Tolerance())
1.2059 - : Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph),
1.2060 + ResidualDigraph(const DGR& digraph, const CM& capacity,
1.2061 + FM& flow, const TL& tolerance = Tolerance())
1.2062 + : Parent(), _capacity(&capacity), _flow(&flow),
1.2063 + _graph(digraph), _node_filter(),
1.2064 _forward_filter(capacity, flow, tolerance),
1.2065 _backward_filter(capacity, flow, tolerance),
1.2066 _arc_filter(_forward_filter, _backward_filter)
1.2067 {
1.2068 - Parent::setDigraph(_graph);
1.2069 - Parent::setArcFilterMap(_arc_filter);
1.2070 + Parent::initialize(_graph, _node_filter, _arc_filter);
1.2071 }
1.2072
1.2073 typedef typename Parent::Arc Arc;
1.2074 @@ -2845,7 +2831,8 @@
1.2075 typedef typename CapacityMap::Value Value;
1.2076
1.2077 /// Constructor
1.2078 - ResidualCapacity(const Adaptor& adaptor) : _adaptor(&adaptor) {}
1.2079 + ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor)
1.2080 + : _adaptor(&adaptor) {}
1.2081
1.2082 /// Returns the value associated with the given residual arc
1.2083 Value operator[](const Arc& a) const {
1.2084 @@ -2865,26 +2852,26 @@
1.2085
1.2086 /// \brief Returns a (read-only) Residual adaptor
1.2087 ///
1.2088 - /// This function just returns a (read-only) \ref Residual adaptor.
1.2089 + /// This function just returns a (read-only) \ref ResidualDigraph adaptor.
1.2090 /// \ingroup graph_adaptors
1.2091 - /// \relates Residual
1.2092 - template<typename GR, typename CM, typename FM>
1.2093 - ResidualDigraph<GR, CM, FM>
1.2094 - residualDigraph(const GR& digraph, const CM& capacity_map, FM& flow_map) {
1.2095 - return ResidualDigraph<GR, CM, FM> (digraph, capacity_map, flow_map);
1.2096 + /// \relates ResidualDigraph
1.2097 + template<typename DGR, typename CM, typename FM>
1.2098 + ResidualDigraph<DGR, CM, FM>
1.2099 + residualDigraph(const DGR& digraph, const CM& capacity_map, FM& flow_map) {
1.2100 + return ResidualDigraph<DGR, CM, FM> (digraph, capacity_map, flow_map);
1.2101 }
1.2102
1.2103
1.2104 - template <typename _Digraph>
1.2105 + template <typename DGR>
1.2106 class SplitNodesBase {
1.2107 public:
1.2108
1.2109 - typedef _Digraph Digraph;
1.2110 - typedef DigraphAdaptorBase<const _Digraph> Parent;
1.2111 + typedef DGR Digraph;
1.2112 + typedef DigraphAdaptorBase<const DGR> Parent;
1.2113 typedef SplitNodesBase Adaptor;
1.2114
1.2115 - typedef typename Digraph::Node DigraphNode;
1.2116 - typedef typename Digraph::Arc DigraphArc;
1.2117 + typedef typename DGR::Node DigraphNode;
1.2118 + typedef typename DGR::Arc DigraphArc;
1.2119
1.2120 class Node;
1.2121 class Arc;
1.2122 @@ -3148,32 +3135,32 @@
1.2123
1.2124 private:
1.2125
1.2126 - template <typename _Value>
1.2127 + template <typename V>
1.2128 class NodeMapBase
1.2129 - : public MapTraits<typename Parent::template NodeMap<_Value> > {
1.2130 - typedef typename Parent::template NodeMap<_Value> NodeImpl;
1.2131 + : public MapTraits<typename Parent::template NodeMap<V> > {
1.2132 + typedef typename Parent::template NodeMap<V> NodeImpl;
1.2133 public:
1.2134 typedef Node Key;
1.2135 - typedef _Value Value;
1.2136 + typedef V Value;
1.2137 typedef typename MapTraits<NodeImpl>::ReferenceMapTag ReferenceMapTag;
1.2138 typedef typename MapTraits<NodeImpl>::ReturnValue ReturnValue;
1.2139 typedef typename MapTraits<NodeImpl>::ConstReturnValue ConstReturnValue;
1.2140 typedef typename MapTraits<NodeImpl>::ReturnValue Reference;
1.2141 typedef typename MapTraits<NodeImpl>::ConstReturnValue ConstReference;
1.2142
1.2143 - NodeMapBase(const Adaptor& adaptor)
1.2144 + NodeMapBase(const SplitNodesBase<DGR>& adaptor)
1.2145 : _in_map(*adaptor._digraph), _out_map(*adaptor._digraph) {}
1.2146 - NodeMapBase(const Adaptor& adaptor, const Value& value)
1.2147 + NodeMapBase(const SplitNodesBase<DGR>& adaptor, const V& value)
1.2148 : _in_map(*adaptor._digraph, value),
1.2149 _out_map(*adaptor._digraph, value) {}
1.2150
1.2151 - void set(const Node& key, const Value& val) {
1.2152 - if (Adaptor::inNode(key)) { _in_map.set(key, val); }
1.2153 + void set(const Node& key, const V& val) {
1.2154 + if (SplitNodesBase<DGR>::inNode(key)) { _in_map.set(key, val); }
1.2155 else {_out_map.set(key, val); }
1.2156 }
1.2157
1.2158 ReturnValue operator[](const Node& key) {
1.2159 - if (Adaptor::inNode(key)) { return _in_map[key]; }
1.2160 + if (SplitNodesBase<DGR>::inNode(key)) { return _in_map[key]; }
1.2161 else { return _out_map[key]; }
1.2162 }
1.2163
1.2164 @@ -3186,28 +3173,28 @@
1.2165 NodeImpl _in_map, _out_map;
1.2166 };
1.2167
1.2168 - template <typename _Value>
1.2169 + template <typename V>
1.2170 class ArcMapBase
1.2171 - : public MapTraits<typename Parent::template ArcMap<_Value> > {
1.2172 - typedef typename Parent::template ArcMap<_Value> ArcImpl;
1.2173 - typedef typename Parent::template NodeMap<_Value> NodeImpl;
1.2174 + : public MapTraits<typename Parent::template ArcMap<V> > {
1.2175 + typedef typename Parent::template ArcMap<V> ArcImpl;
1.2176 + typedef typename Parent::template NodeMap<V> NodeImpl;
1.2177 public:
1.2178 typedef Arc Key;
1.2179 - typedef _Value Value;
1.2180 + typedef V Value;
1.2181 typedef typename MapTraits<ArcImpl>::ReferenceMapTag ReferenceMapTag;
1.2182 typedef typename MapTraits<ArcImpl>::ReturnValue ReturnValue;
1.2183 typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReturnValue;
1.2184 typedef typename MapTraits<ArcImpl>::ReturnValue Reference;
1.2185 typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReference;
1.2186
1.2187 - ArcMapBase(const Adaptor& adaptor)
1.2188 + ArcMapBase(const SplitNodesBase<DGR>& adaptor)
1.2189 : _arc_map(*adaptor._digraph), _node_map(*adaptor._digraph) {}
1.2190 - ArcMapBase(const Adaptor& adaptor, const Value& value)
1.2191 + ArcMapBase(const SplitNodesBase<DGR>& adaptor, const V& value)
1.2192 : _arc_map(*adaptor._digraph, value),
1.2193 _node_map(*adaptor._digraph, value) {}
1.2194
1.2195 - void set(const Arc& key, const Value& val) {
1.2196 - if (Adaptor::origArc(key)) {
1.2197 + void set(const Arc& key, const V& val) {
1.2198 + if (SplitNodesBase<DGR>::origArc(key)) {
1.2199 _arc_map.set(key._item.first(), val);
1.2200 } else {
1.2201 _node_map.set(key._item.second(), val);
1.2202 @@ -3215,7 +3202,7 @@
1.2203 }
1.2204
1.2205 ReturnValue operator[](const Arc& key) {
1.2206 - if (Adaptor::origArc(key)) {
1.2207 + if (SplitNodesBase<DGR>::origArc(key)) {
1.2208 return _arc_map[key._item.first()];
1.2209 } else {
1.2210 return _node_map[key._item.second()];
1.2211 @@ -3223,7 +3210,7 @@
1.2212 }
1.2213
1.2214 ConstReturnValue operator[](const Arc& key) const {
1.2215 - if (Adaptor::origArc(key)) {
1.2216 + if (SplitNodesBase<DGR>::origArc(key)) {
1.2217 return _arc_map[key._item.first()];
1.2218 } else {
1.2219 return _node_map[key._item.second()];
1.2220 @@ -3237,18 +3224,18 @@
1.2221
1.2222 public:
1.2223
1.2224 - template <typename _Value>
1.2225 + template <typename V>
1.2226 class NodeMap
1.2227 - : public SubMapExtender<Adaptor, NodeMapBase<_Value> >
1.2228 + : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> >
1.2229 {
1.2230 public:
1.2231 - typedef _Value Value;
1.2232 - typedef SubMapExtender<Adaptor, NodeMapBase<Value> > Parent;
1.2233 -
1.2234 - NodeMap(const Adaptor& adaptor)
1.2235 + typedef V Value;
1.2236 + typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent;
1.2237 +
1.2238 + NodeMap(const SplitNodesBase<DGR>& adaptor)
1.2239 : Parent(adaptor) {}
1.2240
1.2241 - NodeMap(const Adaptor& adaptor, const Value& value)
1.2242 + NodeMap(const SplitNodesBase<DGR>& adaptor, const V& value)
1.2243 : Parent(adaptor, value) {}
1.2244
1.2245 private:
1.2246 @@ -3263,18 +3250,18 @@
1.2247 }
1.2248 };
1.2249
1.2250 - template <typename _Value>
1.2251 + template <typename V>
1.2252 class ArcMap
1.2253 - : public SubMapExtender<Adaptor, ArcMapBase<_Value> >
1.2254 + : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> >
1.2255 {
1.2256 public:
1.2257 - typedef _Value Value;
1.2258 - typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent;
1.2259 -
1.2260 - ArcMap(const Adaptor& adaptor)
1.2261 + typedef V Value;
1.2262 + typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent;
1.2263 +
1.2264 + ArcMap(const SplitNodesBase<DGR>& adaptor)
1.2265 : Parent(adaptor) {}
1.2266
1.2267 - ArcMap(const Adaptor& adaptor, const Value& value)
1.2268 + ArcMap(const SplitNodesBase<DGR>& adaptor, const V& value)
1.2269 : Parent(adaptor, value) {}
1.2270
1.2271 private:
1.2272 @@ -3293,9 +3280,9 @@
1.2273
1.2274 SplitNodesBase() : _digraph(0) {}
1.2275
1.2276 - Digraph* _digraph;
1.2277 -
1.2278 - void setDigraph(Digraph& digraph) {
1.2279 + DGR* _digraph;
1.2280 +
1.2281 + void initialize(Digraph& digraph) {
1.2282 _digraph = &digraph;
1.2283 }
1.2284
1.2285 @@ -3322,25 +3309,25 @@
1.2286 /// costs/capacities of the original digraph to the \e bind \e arcs
1.2287 /// in the adaptor.
1.2288 ///
1.2289 - /// \tparam GR The type of the adapted digraph.
1.2290 + /// \tparam DGR The type of the adapted digraph.
1.2291 /// It must conform to the \ref concepts::Digraph "Digraph" concept.
1.2292 /// It is implicitly \c const.
1.2293 ///
1.2294 /// \note The \c Node type of this adaptor is converible to the \c Node
1.2295 /// type of the adapted digraph.
1.2296 - template <typename GR>
1.2297 + template <typename DGR>
1.2298 #ifdef DOXYGEN
1.2299 class SplitNodes {
1.2300 #else
1.2301 class SplitNodes
1.2302 - : public DigraphAdaptorExtender<SplitNodesBase<const GR> > {
1.2303 + : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > {
1.2304 #endif
1.2305 public:
1.2306 - typedef GR Digraph;
1.2307 - typedef DigraphAdaptorExtender<SplitNodesBase<const GR> > Parent;
1.2308 -
1.2309 - typedef typename Digraph::Node DigraphNode;
1.2310 - typedef typename Digraph::Arc DigraphArc;
1.2311 + typedef DGR Digraph;
1.2312 + typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;
1.2313 +
1.2314 + typedef typename DGR::Node DigraphNode;
1.2315 + typedef typename DGR::Arc DigraphArc;
1.2316
1.2317 typedef typename Parent::Node Node;
1.2318 typedef typename Parent::Arc Arc;
1.2319 @@ -3348,8 +3335,8 @@
1.2320 /// \brief Constructor
1.2321 ///
1.2322 /// Constructor of the adaptor.
1.2323 - SplitNodes(const Digraph& g) {
1.2324 - Parent::setDigraph(g);
1.2325 + SplitNodes(const DGR& g) {
1.2326 + Parent::initialize(g);
1.2327 }
1.2328
1.2329 /// \brief Returns \c true if the given node is an in-node.
1.2330 @@ -3441,7 +3428,7 @@
1.2331
1.2332 /// Returns the value associated with the given key.
1.2333 Value operator[](const Key& key) const {
1.2334 - if (Parent::inNode(key)) {
1.2335 + if (SplitNodesBase<const DGR>::inNode(key)) {
1.2336 return _in_map[key];
1.2337 } else {
1.2338 return _out_map[key];
1.2339 @@ -3450,7 +3437,7 @@
1.2340
1.2341 /// Returns a reference to the value associated with the given key.
1.2342 Value& operator[](const Key& key) {
1.2343 - if (Parent::inNode(key)) {
1.2344 + if (SplitNodesBase<const DGR>::inNode(key)) {
1.2345 return _in_map[key];
1.2346 } else {
1.2347 return _out_map[key];
1.2348 @@ -3459,7 +3446,7 @@
1.2349
1.2350 /// Sets the value associated with the given key.
1.2351 void set(const Key& key, const Value& value) {
1.2352 - if (Parent::inNode(key)) {
1.2353 + if (SplitNodesBase<const DGR>::inNode(key)) {
1.2354 _in_map.set(key, value);
1.2355 } else {
1.2356 _out_map.set(key, value);
1.2357 @@ -3530,7 +3517,7 @@
1.2358
1.2359 /// Returns the value associated with the given key.
1.2360 Value operator[](const Key& arc) const {
1.2361 - if (Parent::origArc(arc)) {
1.2362 + if (SplitNodesBase<const DGR>::origArc(arc)) {
1.2363 return _arc_map[arc];
1.2364 } else {
1.2365 return _node_map[arc];
1.2366 @@ -3539,7 +3526,7 @@
1.2367
1.2368 /// Returns a reference to the value associated with the given key.
1.2369 Value& operator[](const Key& arc) {
1.2370 - if (Parent::origArc(arc)) {
1.2371 + if (SplitNodesBase<const DGR>::origArc(arc)) {
1.2372 return _arc_map[arc];
1.2373 } else {
1.2374 return _node_map[arc];
1.2375 @@ -3548,7 +3535,7 @@
1.2376
1.2377 /// Sets the value associated with the given key.
1.2378 void set(const Arc& arc, const Value& val) {
1.2379 - if (Parent::origArc(arc)) {
1.2380 + if (SplitNodesBase<const DGR>::origArc(arc)) {
1.2381 _arc_map.set(arc, val);
1.2382 } else {
1.2383 _node_map.set(arc, val);
1.2384 @@ -3594,12 +3581,14 @@
1.2385 /// This function just returns a (read-only) \ref SplitNodes adaptor.
1.2386 /// \ingroup graph_adaptors
1.2387 /// \relates SplitNodes
1.2388 - template<typename GR>
1.2389 - SplitNodes<GR>
1.2390 - splitNodes(const GR& digraph) {
1.2391 - return SplitNodes<GR>(digraph);
1.2392 + template<typename DGR>
1.2393 + SplitNodes<DGR>
1.2394 + splitNodes(const DGR& digraph) {
1.2395 + return SplitNodes<DGR>(digraph);
1.2396 }
1.2397
1.2398 +#undef LEMON_SCOPE_FIX
1.2399 +
1.2400 } //namespace lemon
1.2401
1.2402 #endif //LEMON_ADAPTORS_H
2.1 --- a/lemon/edge_set.h Fri Jan 23 16:42:07 2009 +0000
2.2 +++ b/lemon/edge_set.h Fri Feb 13 13:29:28 2009 +0100
2.3 @@ -29,13 +29,13 @@
2.4 /// Graphs which use another graph's node-set as own.
2.5 namespace lemon {
2.6
2.7 - template <typename _Graph>
2.8 + template <typename GR>
2.9 class ListArcSetBase {
2.10 public:
2.11
2.12 - typedef _Graph Graph;
2.13 - typedef typename Graph::Node Node;
2.14 - typedef typename Graph::NodeIt NodeIt;
2.15 + typedef GR Graph;
2.16 + typedef typename GR::Node Node;
2.17 + typedef typename GR::NodeIt NodeIt;
2.18
2.19 protected:
2.20
2.21 @@ -44,10 +44,10 @@
2.22 NodeT() : first_out(-1), first_in(-1) {}
2.23 };
2.24
2.25 - typedef typename ItemSetTraits<Graph, Node>::
2.26 + typedef typename ItemSetTraits<GR, Node>::
2.27 template Map<NodeT>::Type NodesImplBase;
2.28
2.29 - NodesImplBase* nodes;
2.30 + NodesImplBase* _nodes;
2.31
2.32 struct ArcT {
2.33 Node source, target;
2.34 @@ -61,17 +61,17 @@
2.35 int first_arc;
2.36 int first_free_arc;
2.37
2.38 - const Graph* graph;
2.39 + const GR* _graph;
2.40
2.41 - void initalize(const Graph& _graph, NodesImplBase& _nodes) {
2.42 - graph = &_graph;
2.43 - nodes = &_nodes;
2.44 + void initalize(const GR& graph, NodesImplBase& nodes) {
2.45 + _graph = &graph;
2.46 + _nodes = &nodes;
2.47 }
2.48
2.49 public:
2.50
2.51 class Arc {
2.52 - friend class ListArcSetBase<Graph>;
2.53 + friend class ListArcSetBase<GR>;
2.54 protected:
2.55 Arc(int _id) : id(_id) {}
2.56 int id;
2.57 @@ -94,16 +94,16 @@
2.58 n = first_free_arc;
2.59 first_free_arc = arcs[first_free_arc].next_in;
2.60 }
2.61 - arcs[n].next_in = (*nodes)[v].first_in;
2.62 - if ((*nodes)[v].first_in != -1) {
2.63 - arcs[(*nodes)[v].first_in].prev_in = n;
2.64 + arcs[n].next_in = (*_nodes)[v].first_in;
2.65 + if ((*_nodes)[v].first_in != -1) {
2.66 + arcs[(*_nodes)[v].first_in].prev_in = n;
2.67 }
2.68 - (*nodes)[v].first_in = n;
2.69 - arcs[n].next_out = (*nodes)[u].first_out;
2.70 - if ((*nodes)[u].first_out != -1) {
2.71 - arcs[(*nodes)[u].first_out].prev_out = n;
2.72 + (*_nodes)[v].first_in = n;
2.73 + arcs[n].next_out = (*_nodes)[u].first_out;
2.74 + if ((*_nodes)[u].first_out != -1) {
2.75 + arcs[(*_nodes)[u].first_out].prev_out = n;
2.76 }
2.77 - (*nodes)[u].first_out = n;
2.78 + (*_nodes)[u].first_out = n;
2.79 arcs[n].source = u;
2.80 arcs[n].target = v;
2.81 return Arc(n);
2.82 @@ -114,7 +114,7 @@
2.83 if (arcs[n].prev_in != -1) {
2.84 arcs[arcs[n].prev_in].next_in = arcs[n].next_in;
2.85 } else {
2.86 - (*nodes)[arcs[n].target].first_in = arcs[n].next_in;
2.87 + (*_nodes)[arcs[n].target].first_in = arcs[n].next_in;
2.88 }
2.89 if (arcs[n].next_in != -1) {
2.90 arcs[arcs[n].next_in].prev_in = arcs[n].prev_in;
2.91 @@ -123,7 +123,7 @@
2.92 if (arcs[n].prev_out != -1) {
2.93 arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
2.94 } else {
2.95 - (*nodes)[arcs[n].source].first_out = arcs[n].next_out;
2.96 + (*_nodes)[arcs[n].source].first_out = arcs[n].next_out;
2.97 }
2.98 if (arcs[n].next_out != -1) {
2.99 arcs[arcs[n].next_out].prev_out = arcs[n].prev_out;
2.100 @@ -134,8 +134,8 @@
2.101 void clear() {
2.102 Node node;
2.103 for (first(node); node != INVALID; next(node)) {
2.104 - (*nodes)[node].first_in = -1;
2.105 - (*nodes)[node].first_out = -1;
2.106 + (*_nodes)[node].first_in = -1;
2.107 + (*_nodes)[node].first_out = -1;
2.108 }
2.109 arcs.clear();
2.110 first_arc = -1;
2.111 @@ -143,20 +143,20 @@
2.112 }
2.113
2.114 void first(Node& node) const {
2.115 - graph->first(node);
2.116 + _graph->first(node);
2.117 }
2.118
2.119 void next(Node& node) const {
2.120 - graph->next(node);
2.121 + _graph->next(node);
2.122 }
2.123
2.124 void first(Arc& arc) const {
2.125 Node node;
2.126 first(node);
2.127 - while (node != INVALID && (*nodes)[node].first_in == -1) {
2.128 + while (node != INVALID && (*_nodes)[node].first_in == -1) {
2.129 next(node);
2.130 }
2.131 - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in;
2.132 + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in;
2.133 }
2.134
2.135 void next(Arc& arc) const {
2.136 @@ -165,15 +165,15 @@
2.137 } else {
2.138 Node node = arcs[arc.id].target;
2.139 next(node);
2.140 - while (node != INVALID && (*nodes)[node].first_in == -1) {
2.141 + while (node != INVALID && (*_nodes)[node].first_in == -1) {
2.142 next(node);
2.143 }
2.144 - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in;
2.145 + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in;
2.146 }
2.147 }
2.148
2.149 void firstOut(Arc& arc, const Node& node) const {
2.150 - arc.id = (*nodes)[node].first_out;
2.151 + arc.id = (*_nodes)[node].first_out;
2.152 }
2.153
2.154 void nextOut(Arc& arc) const {
2.155 @@ -181,42 +181,42 @@
2.156 }
2.157
2.158 void firstIn(Arc& arc, const Node& node) const {
2.159 - arc.id = (*nodes)[node].first_in;
2.160 + arc.id = (*_nodes)[node].first_in;
2.161 }
2.162
2.163 void nextIn(Arc& arc) const {
2.164 arc.id = arcs[arc.id].next_in;
2.165 }
2.166
2.167 - int id(const Node& node) const { return graph->id(node); }
2.168 + int id(const Node& node) const { return _graph->id(node); }
2.169 int id(const Arc& arc) const { return arc.id; }
2.170
2.171 - Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
2.172 + Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
2.173 Arc arcFromId(int ix) const { return Arc(ix); }
2.174
2.175 - int maxNodeId() const { return graph->maxNodeId(); };
2.176 + int maxNodeId() const { return _graph->maxNodeId(); };
2.177 int maxArcId() const { return arcs.size() - 1; }
2.178
2.179 Node source(const Arc& arc) const { return arcs[arc.id].source;}
2.180 Node target(const Arc& arc) const { return arcs[arc.id].target;}
2.181
2.182 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
2.183 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
2.184
2.185 NodeNotifier& notifier(Node) const {
2.186 - return graph->notifier(Node());
2.187 + return _graph->notifier(Node());
2.188 }
2.189
2.190 - template <typename _Value>
2.191 - class NodeMap : public Graph::template NodeMap<_Value> {
2.192 + template <typename V>
2.193 + class NodeMap : public GR::template NodeMap<V> {
2.194 public:
2.195
2.196 - typedef typename _Graph::template NodeMap<_Value> Parent;
2.197 + typedef typename GR::template NodeMap<V> Parent;
2.198
2.199 - explicit NodeMap(const ListArcSetBase<Graph>& arcset)
2.200 - : Parent(*arcset.graph) {}
2.201 + explicit NodeMap(const ListArcSetBase<GR>& arcset)
2.202 + : Parent(*arcset._graph) {}
2.203
2.204 - NodeMap(const ListArcSetBase<Graph>& arcset, const _Value& value)
2.205 - : Parent(*arcset.graph, value) {}
2.206 + NodeMap(const ListArcSetBase<GR>& arcset, const V& value)
2.207 + : Parent(*arcset._graph, value) {}
2.208
2.209 NodeMap& operator=(const NodeMap& cmap) {
2.210 return operator=<NodeMap>(cmap);
2.211 @@ -250,24 +250,24 @@
2.212 /// that node can be removed from the underlying graph, in this case
2.213 /// all arcs incident to the given node is erased from the arc set.
2.214 ///
2.215 - /// \param _Graph The type of the graph which shares its node set with
2.216 + /// \param GR The type of the graph which shares its node set with
2.217 /// this class. Its interface must conform to the
2.218 /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
2.219 /// concept.
2.220 ///
2.221 /// This class is fully conform to the \ref concepts::Digraph
2.222 /// "Digraph" concept.
2.223 - template <typename _Graph>
2.224 - class ListArcSet : public ArcSetExtender<ListArcSetBase<_Graph> > {
2.225 + template <typename GR>
2.226 + class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
2.227
2.228 public:
2.229
2.230 - typedef ArcSetExtender<ListArcSetBase<_Graph> > Parent;
2.231 + typedef ArcSetExtender<ListArcSetBase<GR> > Parent;
2.232
2.233 typedef typename Parent::Node Node;
2.234 typedef typename Parent::Arc Arc;
2.235
2.236 - typedef _Graph Graph;
2.237 + typedef GR Graph;
2.238
2.239
2.240 typedef typename Parent::NodesImplBase NodesImplBase;
2.241 @@ -295,7 +295,7 @@
2.242 public:
2.243 typedef NodesImplBase Parent;
2.244
2.245 - NodesImpl(const Graph& graph, ListArcSet& arcset)
2.246 + NodesImpl(const GR& graph, ListArcSet& arcset)
2.247 : Parent(graph), _arcset(arcset) {}
2.248
2.249 virtual ~NodesImpl() {}
2.250 @@ -321,15 +321,15 @@
2.251 ListArcSet& _arcset;
2.252 };
2.253
2.254 - NodesImpl nodes;
2.255 + NodesImpl _nodes;
2.256
2.257 public:
2.258
2.259 /// \brief Constructor of the ArcSet.
2.260 ///
2.261 /// Constructor of the ArcSet.
2.262 - ListArcSet(const Graph& graph) : nodes(graph, *this) {
2.263 - Parent::initalize(graph, nodes);
2.264 + ListArcSet(const GR& graph) : _nodes(graph, *this) {
2.265 + Parent::initalize(graph, _nodes);
2.266 }
2.267
2.268 /// \brief Add a new arc to the digraph.
2.269 @@ -350,13 +350,13 @@
2.270
2.271 };
2.272
2.273 - template <typename _Graph>
2.274 + template <typename GR>
2.275 class ListEdgeSetBase {
2.276 public:
2.277
2.278 - typedef _Graph Graph;
2.279 - typedef typename Graph::Node Node;
2.280 - typedef typename Graph::NodeIt NodeIt;
2.281 + typedef GR Graph;
2.282 + typedef typename GR::Node Node;
2.283 + typedef typename GR::NodeIt NodeIt;
2.284
2.285 protected:
2.286
2.287 @@ -365,10 +365,10 @@
2.288 NodeT() : first_out(-1) {}
2.289 };
2.290
2.291 - typedef typename ItemSetTraits<Graph, Node>::
2.292 + typedef typename ItemSetTraits<GR, Node>::
2.293 template Map<NodeT>::Type NodesImplBase;
2.294
2.295 - NodesImplBase* nodes;
2.296 + NodesImplBase* _nodes;
2.297
2.298 struct ArcT {
2.299 Node target;
2.300 @@ -381,11 +381,11 @@
2.301 int first_arc;
2.302 int first_free_arc;
2.303
2.304 - const Graph* graph;
2.305 + const GR* _graph;
2.306
2.307 - void initalize(const Graph& _graph, NodesImplBase& _nodes) {
2.308 - graph = &_graph;
2.309 - nodes = &_nodes;
2.310 + void initalize(const GR& graph, NodesImplBase& nodes) {
2.311 + _graph = &graph;
2.312 + _nodes = &nodes;
2.313 }
2.314
2.315 public:
2.316 @@ -437,18 +437,18 @@
2.317 arcs[n].target = u;
2.318 arcs[n | 1].target = v;
2.319
2.320 - arcs[n].next_out = (*nodes)[v].first_out;
2.321 - if ((*nodes)[v].first_out != -1) {
2.322 - arcs[(*nodes)[v].first_out].prev_out = n;
2.323 + arcs[n].next_out = (*_nodes)[v].first_out;
2.324 + if ((*_nodes)[v].first_out != -1) {
2.325 + arcs[(*_nodes)[v].first_out].prev_out = n;
2.326 }
2.327 - (*nodes)[v].first_out = n;
2.328 + (*_nodes)[v].first_out = n;
2.329 arcs[n].prev_out = -1;
2.330
2.331 - if ((*nodes)[u].first_out != -1) {
2.332 - arcs[(*nodes)[u].first_out].prev_out = (n | 1);
2.333 + if ((*_nodes)[u].first_out != -1) {
2.334 + arcs[(*_nodes)[u].first_out].prev_out = (n | 1);
2.335 }
2.336 - arcs[n | 1].next_out = (*nodes)[u].first_out;
2.337 - (*nodes)[u].first_out = (n | 1);
2.338 + arcs[n | 1].next_out = (*_nodes)[u].first_out;
2.339 + (*_nodes)[u].first_out = (n | 1);
2.340 arcs[n | 1].prev_out = -1;
2.341
2.342 return Edge(n / 2);
2.343 @@ -464,7 +464,7 @@
2.344 if (arcs[n].prev_out != -1) {
2.345 arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
2.346 } else {
2.347 - (*nodes)[arcs[n | 1].target].first_out = arcs[n].next_out;
2.348 + (*_nodes)[arcs[n | 1].target].first_out = arcs[n].next_out;
2.349 }
2.350
2.351 if (arcs[n | 1].next_out != -1) {
2.352 @@ -474,7 +474,7 @@
2.353 if (arcs[n | 1].prev_out != -1) {
2.354 arcs[arcs[n | 1].prev_out].next_out = arcs[n | 1].next_out;
2.355 } else {
2.356 - (*nodes)[arcs[n].target].first_out = arcs[n | 1].next_out;
2.357 + (*_nodes)[arcs[n].target].first_out = arcs[n | 1].next_out;
2.358 }
2.359
2.360 arcs[n].next_out = first_free_arc;
2.361 @@ -485,7 +485,7 @@
2.362 void clear() {
2.363 Node node;
2.364 for (first(node); node != INVALID; next(node)) {
2.365 - (*nodes)[node].first_out = -1;
2.366 + (*_nodes)[node].first_out = -1;
2.367 }
2.368 arcs.clear();
2.369 first_arc = -1;
2.370 @@ -493,20 +493,20 @@
2.371 }
2.372
2.373 void first(Node& node) const {
2.374 - graph->first(node);
2.375 + _graph->first(node);
2.376 }
2.377
2.378 void next(Node& node) const {
2.379 - graph->next(node);
2.380 + _graph->next(node);
2.381 }
2.382
2.383 void first(Arc& arc) const {
2.384 Node node;
2.385 first(node);
2.386 - while (node != INVALID && (*nodes)[node].first_out == -1) {
2.387 + while (node != INVALID && (*_nodes)[node].first_out == -1) {
2.388 next(node);
2.389 }
2.390 - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out;
2.391 + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out;
2.392 }
2.393
2.394 void next(Arc& arc) const {
2.395 @@ -515,10 +515,10 @@
2.396 } else {
2.397 Node node = arcs[arc.id ^ 1].target;
2.398 next(node);
2.399 - while(node != INVALID && (*nodes)[node].first_out == -1) {
2.400 + while(node != INVALID && (*_nodes)[node].first_out == -1) {
2.401 next(node);
2.402 }
2.403 - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out;
2.404 + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out;
2.405 }
2.406 }
2.407
2.408 @@ -526,7 +526,7 @@
2.409 Node node;
2.410 first(node);
2.411 while (node != INVALID) {
2.412 - edge.id = (*nodes)[node].first_out;
2.413 + edge.id = (*_nodes)[node].first_out;
2.414 while ((edge.id & 1) != 1) {
2.415 edge.id = arcs[edge.id].next_out;
2.416 }
2.417 @@ -551,7 +551,7 @@
2.418 }
2.419 next(node);
2.420 while (node != INVALID) {
2.421 - edge.id = (*nodes)[node].first_out;
2.422 + edge.id = (*_nodes)[node].first_out;
2.423 while ((edge.id & 1) != 1) {
2.424 edge.id = arcs[edge.id].next_out;
2.425 }
2.426 @@ -565,7 +565,7 @@
2.427 }
2.428
2.429 void firstOut(Arc& arc, const Node& node) const {
2.430 - arc.id = (*nodes)[node].first_out;
2.431 + arc.id = (*_nodes)[node].first_out;
2.432 }
2.433
2.434 void nextOut(Arc& arc) const {
2.435 @@ -573,7 +573,7 @@
2.436 }
2.437
2.438 void firstIn(Arc& arc, const Node& node) const {
2.439 - arc.id = (((*nodes)[node].first_out) ^ 1);
2.440 + arc.id = (((*_nodes)[node].first_out) ^ 1);
2.441 if (arc.id == -2) arc.id = -1;
2.442 }
2.443
2.444 @@ -583,7 +583,7 @@
2.445 }
2.446
2.447 void firstInc(Edge &arc, bool& dir, const Node& node) const {
2.448 - int de = (*nodes)[node].first_out;
2.449 + int de = (*_nodes)[node].first_out;
2.450 if (de != -1 ) {
2.451 arc.id = de / 2;
2.452 dir = ((de & 1) == 1);
2.453 @@ -611,15 +611,15 @@
2.454 return Arc(edge.id * 2 + (dir ? 1 : 0));
2.455 }
2.456
2.457 - int id(const Node& node) const { return graph->id(node); }
2.458 + int id(const Node& node) const { return _graph->id(node); }
2.459 static int id(Arc e) { return e.id; }
2.460 static int id(Edge e) { return e.id; }
2.461
2.462 - Node nodeFromId(int id) const { return graph->nodeFromId(id); }
2.463 + Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
2.464 static Arc arcFromId(int id) { return Arc(id);}
2.465 static Edge edgeFromId(int id) { return Edge(id);}
2.466
2.467 - int maxNodeId() const { return graph->maxNodeId(); };
2.468 + int maxNodeId() const { return _graph->maxNodeId(); };
2.469 int maxEdgeId() const { return arcs.size() / 2 - 1; }
2.470 int maxArcId() const { return arcs.size()-1; }
2.471
2.472 @@ -629,23 +629,23 @@
2.473 Node u(Edge e) const { return arcs[2 * e.id].target; }
2.474 Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
2.475
2.476 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
2.477 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
2.478
2.479 NodeNotifier& notifier(Node) const {
2.480 - return graph->notifier(Node());
2.481 + return _graph->notifier(Node());
2.482 }
2.483
2.484 - template <typename _Value>
2.485 - class NodeMap : public Graph::template NodeMap<_Value> {
2.486 + template <typename V>
2.487 + class NodeMap : public GR::template NodeMap<V> {
2.488 public:
2.489
2.490 - typedef typename _Graph::template NodeMap<_Value> Parent;
2.491 + typedef typename GR::template NodeMap<V> Parent;
2.492
2.493 - explicit NodeMap(const ListEdgeSetBase<Graph>& arcset)
2.494 - : Parent(*arcset.graph) {}
2.495 + explicit NodeMap(const ListEdgeSetBase<GR>& arcset)
2.496 + : Parent(*arcset._graph) {}
2.497
2.498 - NodeMap(const ListEdgeSetBase<Graph>& arcset, const _Value& value)
2.499 - : Parent(*arcset.graph, value) {}
2.500 + NodeMap(const ListEdgeSetBase<GR>& arcset, const V& value)
2.501 + : Parent(*arcset._graph, value) {}
2.502
2.503 NodeMap& operator=(const NodeMap& cmap) {
2.504 return operator=<NodeMap>(cmap);
2.505 @@ -679,25 +679,25 @@
2.506 /// be removed from the underlying graph, in this case all edges
2.507 /// incident to the given node is erased from the arc set.
2.508 ///
2.509 - /// \param _Graph The type of the graph which shares its node set
2.510 + /// \param GR The type of the graph which shares its node set
2.511 /// with this class. Its interface must conform to the
2.512 /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
2.513 /// concept.
2.514 ///
2.515 /// This class is fully conform to the \ref concepts::Graph "Graph"
2.516 /// concept.
2.517 - template <typename _Graph>
2.518 - class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<_Graph> > {
2.519 + template <typename GR>
2.520 + class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<GR> > {
2.521
2.522 public:
2.523
2.524 - typedef EdgeSetExtender<ListEdgeSetBase<_Graph> > Parent;
2.525 + typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent;
2.526
2.527 typedef typename Parent::Node Node;
2.528 typedef typename Parent::Arc Arc;
2.529 typedef typename Parent::Edge Edge;
2.530
2.531 - typedef _Graph Graph;
2.532 + typedef GR Graph;
2.533
2.534
2.535 typedef typename Parent::NodesImplBase NodesImplBase;
2.536 @@ -720,7 +720,7 @@
2.537 public:
2.538 typedef NodesImplBase Parent;
2.539
2.540 - NodesImpl(const Graph& graph, ListEdgeSet& arcset)
2.541 + NodesImpl(const GR& graph, ListEdgeSet& arcset)
2.542 : Parent(graph), _arcset(arcset) {}
2.543
2.544 virtual ~NodesImpl() {}
2.545 @@ -746,15 +746,15 @@
2.546 ListEdgeSet& _arcset;
2.547 };
2.548
2.549 - NodesImpl nodes;
2.550 + NodesImpl _nodes;
2.551
2.552 public:
2.553
2.554 /// \brief Constructor of the EdgeSet.
2.555 ///
2.556 /// Constructor of the EdgeSet.
2.557 - ListEdgeSet(const Graph& graph) : nodes(graph, *this) {
2.558 - Parent::initalize(graph, nodes);
2.559 + ListEdgeSet(const GR& graph) : _nodes(graph, *this) {
2.560 + Parent::initalize(graph, _nodes);
2.561 }
2.562
2.563 /// \brief Add a new edge to the graph.
2.564 @@ -775,11 +775,11 @@
2.565
2.566 };
2.567
2.568 - template <typename _Graph>
2.569 + template <typename GR>
2.570 class SmartArcSetBase {
2.571 public:
2.572
2.573 - typedef _Graph Graph;
2.574 + typedef GR Graph;
2.575 typedef typename Graph::Node Node;
2.576 typedef typename Graph::NodeIt NodeIt;
2.577
2.578 @@ -790,10 +790,10 @@
2.579 NodeT() : first_out(-1), first_in(-1) {}
2.580 };
2.581
2.582 - typedef typename ItemSetTraits<Graph, Node>::
2.583 + typedef typename ItemSetTraits<GR, Node>::
2.584 template Map<NodeT>::Type NodesImplBase;
2.585
2.586 - NodesImplBase* nodes;
2.587 + NodesImplBase* _nodes;
2.588
2.589 struct ArcT {
2.590 Node source, target;
2.591 @@ -803,17 +803,17 @@
2.592
2.593 std::vector<ArcT> arcs;
2.594
2.595 - const Graph* graph;
2.596 + const GR* _graph;
2.597
2.598 - void initalize(const Graph& _graph, NodesImplBase& _nodes) {
2.599 - graph = &_graph;
2.600 - nodes = &_nodes;
2.601 + void initalize(const GR& graph, NodesImplBase& nodes) {
2.602 + _graph = &graph;
2.603 + _nodes = &nodes;
2.604 }
2.605
2.606 public:
2.607
2.608 class Arc {
2.609 - friend class SmartArcSetBase<Graph>;
2.610 + friend class SmartArcSetBase<GR>;
2.611 protected:
2.612 Arc(int _id) : id(_id) {}
2.613 int id;
2.614 @@ -830,10 +830,10 @@
2.615 Arc addArc(const Node& u, const Node& v) {
2.616 int n = arcs.size();
2.617 arcs.push_back(ArcT());
2.618 - arcs[n].next_in = (*nodes)[v].first_in;
2.619 - (*nodes)[v].first_in = n;
2.620 - arcs[n].next_out = (*nodes)[u].first_out;
2.621 - (*nodes)[u].first_out = n;
2.622 + arcs[n].next_in = (*_nodes)[v].first_in;
2.623 + (*_nodes)[v].first_in = n;
2.624 + arcs[n].next_out = (*_nodes)[u].first_out;
2.625 + (*_nodes)[u].first_out = n;
2.626 arcs[n].source = u;
2.627 arcs[n].target = v;
2.628 return Arc(n);
2.629 @@ -842,18 +842,18 @@
2.630 void clear() {
2.631 Node node;
2.632 for (first(node); node != INVALID; next(node)) {
2.633 - (*nodes)[node].first_in = -1;
2.634 - (*nodes)[node].first_out = -1;
2.635 + (*_nodes)[node].first_in = -1;
2.636 + (*_nodes)[node].first_out = -1;
2.637 }
2.638 arcs.clear();
2.639 }
2.640
2.641 void first(Node& node) const {
2.642 - graph->first(node);
2.643 + _graph->first(node);
2.644 }
2.645
2.646 void next(Node& node) const {
2.647 - graph->next(node);
2.648 + _graph->next(node);
2.649 }
2.650
2.651 void first(Arc& arc) const {
2.652 @@ -865,7 +865,7 @@
2.653 }
2.654
2.655 void firstOut(Arc& arc, const Node& node) const {
2.656 - arc.id = (*nodes)[node].first_out;
2.657 + arc.id = (*_nodes)[node].first_out;
2.658 }
2.659
2.660 void nextOut(Arc& arc) const {
2.661 @@ -873,42 +873,42 @@
2.662 }
2.663
2.664 void firstIn(Arc& arc, const Node& node) const {
2.665 - arc.id = (*nodes)[node].first_in;
2.666 + arc.id = (*_nodes)[node].first_in;
2.667 }
2.668
2.669 void nextIn(Arc& arc) const {
2.670 arc.id = arcs[arc.id].next_in;
2.671 }
2.672
2.673 - int id(const Node& node) const { return graph->id(node); }
2.674 + int id(const Node& node) const { return _graph->id(node); }
2.675 int id(const Arc& arc) const { return arc.id; }
2.676
2.677 - Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
2.678 + Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
2.679 Arc arcFromId(int ix) const { return Arc(ix); }
2.680
2.681 - int maxNodeId() const { return graph->maxNodeId(); };
2.682 + int maxNodeId() const { return _graph->maxNodeId(); };
2.683 int maxArcId() const { return arcs.size() - 1; }
2.684
2.685 Node source(const Arc& arc) const { return arcs[arc.id].source;}
2.686 Node target(const Arc& arc) const { return arcs[arc.id].target;}
2.687
2.688 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
2.689 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
2.690
2.691 NodeNotifier& notifier(Node) const {
2.692 - return graph->notifier(Node());
2.693 + return _graph->notifier(Node());
2.694 }
2.695
2.696 - template <typename _Value>
2.697 - class NodeMap : public Graph::template NodeMap<_Value> {
2.698 + template <typename V>
2.699 + class NodeMap : public GR::template NodeMap<V> {
2.700 public:
2.701
2.702 - typedef typename _Graph::template NodeMap<_Value> Parent;
2.703 + typedef typename GR::template NodeMap<V> Parent;
2.704
2.705 - explicit NodeMap(const SmartArcSetBase<Graph>& arcset)
2.706 - : Parent(*arcset.graph) { }
2.707 + explicit NodeMap(const SmartArcSetBase<GR>& arcset)
2.708 + : Parent(*arcset._graph) { }
2.709
2.710 - NodeMap(const SmartArcSetBase<Graph>& arcset, const _Value& value)
2.711 - : Parent(*arcset.graph, value) { }
2.712 + NodeMap(const SmartArcSetBase<GR>& arcset, const V& value)
2.713 + : Parent(*arcset._graph, value) { }
2.714
2.715 NodeMap& operator=(const NodeMap& cmap) {
2.716 return operator=<NodeMap>(cmap);
2.717 @@ -937,7 +937,7 @@
2.718 /// class. The node handling functions (id handling, observing, and
2.719 /// iterators) works equivalently as in the original graph.
2.720 ///
2.721 - /// \param _Graph The type of the graph which shares its node set with
2.722 + /// \param GR The type of the graph which shares its node set with
2.723 /// this class. Its interface must conform to the
2.724 /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
2.725 /// concept.
2.726 @@ -954,17 +954,17 @@
2.727 ///
2.728 /// This class is fully conform to the \ref concepts::Digraph
2.729 /// "Digraph" concept.
2.730 - template <typename _Graph>
2.731 - class SmartArcSet : public ArcSetExtender<SmartArcSetBase<_Graph> > {
2.732 + template <typename GR>
2.733 + class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
2.734
2.735 public:
2.736
2.737 - typedef ArcSetExtender<SmartArcSetBase<_Graph> > Parent;
2.738 + typedef ArcSetExtender<SmartArcSetBase<GR> > Parent;
2.739
2.740 typedef typename Parent::Node Node;
2.741 typedef typename Parent::Arc Arc;
2.742
2.743 - typedef _Graph Graph;
2.744 + typedef GR Graph;
2.745
2.746 protected:
2.747
2.748 @@ -986,7 +986,7 @@
2.749 public:
2.750 typedef NodesImplBase Parent;
2.751
2.752 - NodesImpl(const Graph& graph, SmartArcSet& arcset)
2.753 + NodesImpl(const GR& graph, SmartArcSet& arcset)
2.754 : Parent(graph), _arcset(arcset) {}
2.755
2.756 virtual ~NodesImpl() {}
2.757 @@ -1026,15 +1026,15 @@
2.758 SmartArcSet& _arcset;
2.759 };
2.760
2.761 - NodesImpl nodes;
2.762 + NodesImpl _nodes;
2.763
2.764 public:
2.765
2.766 /// \brief Constructor of the ArcSet.
2.767 ///
2.768 /// Constructor of the ArcSet.
2.769 - SmartArcSet(const Graph& graph) : nodes(graph, *this) {
2.770 - Parent::initalize(graph, nodes);
2.771 + SmartArcSet(const GR& graph) : _nodes(graph, *this) {
2.772 + Parent::initalize(graph, _nodes);
2.773 }
2.774
2.775 /// \brief Add a new arc to the digraph.
2.776 @@ -1052,19 +1052,19 @@
2.777 /// invalidated. It occurs when a node in the underlying graph is
2.778 /// erased and it is not isolated in the ArcSet.
2.779 bool valid() const {
2.780 - return nodes.attached();
2.781 + return _nodes.attached();
2.782 }
2.783
2.784 };
2.785
2.786
2.787 - template <typename _Graph>
2.788 + template <typename GR>
2.789 class SmartEdgeSetBase {
2.790 public:
2.791
2.792 - typedef _Graph Graph;
2.793 - typedef typename Graph::Node Node;
2.794 - typedef typename Graph::NodeIt NodeIt;
2.795 + typedef GR Graph;
2.796 + typedef typename GR::Node Node;
2.797 + typedef typename GR::NodeIt NodeIt;
2.798
2.799 protected:
2.800
2.801 @@ -1073,10 +1073,10 @@
2.802 NodeT() : first_out(-1) {}
2.803 };
2.804
2.805 - typedef typename ItemSetTraits<Graph, Node>::
2.806 + typedef typename ItemSetTraits<GR, Node>::
2.807 template Map<NodeT>::Type NodesImplBase;
2.808
2.809 - NodesImplBase* nodes;
2.810 + NodesImplBase* _nodes;
2.811
2.812 struct ArcT {
2.813 Node target;
2.814 @@ -1086,11 +1086,11 @@
2.815
2.816 std::vector<ArcT> arcs;
2.817
2.818 - const Graph* graph;
2.819 + const GR* _graph;
2.820
2.821 - void initalize(const Graph& _graph, NodesImplBase& _nodes) {
2.822 - graph = &_graph;
2.823 - nodes = &_nodes;
2.824 + void initalize(const GR& graph, NodesImplBase& nodes) {
2.825 + _graph = &graph;
2.826 + _nodes = &nodes;
2.827 }
2.828
2.829 public:
2.830 @@ -1135,11 +1135,11 @@
2.831 arcs[n].target = u;
2.832 arcs[n | 1].target = v;
2.833
2.834 - arcs[n].next_out = (*nodes)[v].first_out;
2.835 - (*nodes)[v].first_out = n;
2.836 + arcs[n].next_out = (*_nodes)[v].first_out;
2.837 + (*_nodes)[v].first_out = n;
2.838
2.839 - arcs[n | 1].next_out = (*nodes)[u].first_out;
2.840 - (*nodes)[u].first_out = (n | 1);
2.841 + arcs[n | 1].next_out = (*_nodes)[u].first_out;
2.842 + (*_nodes)[u].first_out = (n | 1);
2.843
2.844 return Edge(n / 2);
2.845 }
2.846 @@ -1147,17 +1147,17 @@
2.847 void clear() {
2.848 Node node;
2.849 for (first(node); node != INVALID; next(node)) {
2.850 - (*nodes)[node].first_out = -1;
2.851 + (*_nodes)[node].first_out = -1;
2.852 }
2.853 arcs.clear();
2.854 }
2.855
2.856 void first(Node& node) const {
2.857 - graph->first(node);
2.858 + _graph->first(node);
2.859 }
2.860
2.861 void next(Node& node) const {
2.862 - graph->next(node);
2.863 + _graph->next(node);
2.864 }
2.865
2.866 void first(Arc& arc) const {
2.867 @@ -1177,7 +1177,7 @@
2.868 }
2.869
2.870 void firstOut(Arc& arc, const Node& node) const {
2.871 - arc.id = (*nodes)[node].first_out;
2.872 + arc.id = (*_nodes)[node].first_out;
2.873 }
2.874
2.875 void nextOut(Arc& arc) const {
2.876 @@ -1185,7 +1185,7 @@
2.877 }
2.878
2.879 void firstIn(Arc& arc, const Node& node) const {
2.880 - arc.id = (((*nodes)[node].first_out) ^ 1);
2.881 + arc.id = (((*_nodes)[node].first_out) ^ 1);
2.882 if (arc.id == -2) arc.id = -1;
2.883 }
2.884
2.885 @@ -1195,7 +1195,7 @@
2.886 }
2.887
2.888 void firstInc(Edge &arc, bool& dir, const Node& node) const {
2.889 - int de = (*nodes)[node].first_out;
2.890 + int de = (*_nodes)[node].first_out;
2.891 if (de != -1 ) {
2.892 arc.id = de / 2;
2.893 dir = ((de & 1) == 1);
2.894 @@ -1223,15 +1223,15 @@
2.895 return Arc(edge.id * 2 + (dir ? 1 : 0));
2.896 }
2.897
2.898 - int id(Node node) const { return graph->id(node); }
2.899 + int id(Node node) const { return _graph->id(node); }
2.900 static int id(Arc arc) { return arc.id; }
2.901 static int id(Edge arc) { return arc.id; }
2.902
2.903 - Node nodeFromId(int id) const { return graph->nodeFromId(id); }
2.904 + Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
2.905 static Arc arcFromId(int id) { return Arc(id); }
2.906 static Edge edgeFromId(int id) { return Edge(id);}
2.907
2.908 - int maxNodeId() const { return graph->maxNodeId(); };
2.909 + int maxNodeId() const { return _graph->maxNodeId(); };
2.910 int maxArcId() const { return arcs.size() - 1; }
2.911 int maxEdgeId() const { return arcs.size() / 2 - 1; }
2.912
2.913 @@ -1241,23 +1241,23 @@
2.914 Node u(Edge e) const { return arcs[2 * e.id].target; }
2.915 Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
2.916
2.917 - typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
2.918 + typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier;
2.919
2.920 NodeNotifier& notifier(Node) const {
2.921 - return graph->notifier(Node());
2.922 + return _graph->notifier(Node());
2.923 }
2.924
2.925 - template <typename _Value>
2.926 - class NodeMap : public Graph::template NodeMap<_Value> {
2.927 + template <typename V>
2.928 + class NodeMap : public GR::template NodeMap<V> {
2.929 public:
2.930
2.931 - typedef typename _Graph::template NodeMap<_Value> Parent;
2.932 + typedef typename GR::template NodeMap<V> Parent;
2.933
2.934 - explicit NodeMap(const SmartEdgeSetBase<Graph>& arcset)
2.935 - : Parent(*arcset.graph) { }
2.936 + explicit NodeMap(const SmartEdgeSetBase<GR>& arcset)
2.937 + : Parent(*arcset._graph) { }
2.938
2.939 - NodeMap(const SmartEdgeSetBase<Graph>& arcset, const _Value& value)
2.940 - : Parent(*arcset.graph, value) { }
2.941 + NodeMap(const SmartEdgeSetBase<GR>& arcset, const V& value)
2.942 + : Parent(*arcset._graph, value) { }
2.943
2.944 NodeMap& operator=(const NodeMap& cmap) {
2.945 return operator=<NodeMap>(cmap);
2.946 @@ -1285,7 +1285,7 @@
2.947 /// node handling functions (id handling, observing, and iterators)
2.948 /// works equivalently as in the original graph.
2.949 ///
2.950 - /// \param _Graph The type of the graph which shares its node set
2.951 + /// \param GR The type of the graph which shares its node set
2.952 /// with this class. Its interface must conform to the
2.953 /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph"
2.954 /// concept.
2.955 @@ -1302,18 +1302,18 @@
2.956 ///
2.957 /// This class is fully conform to the \ref concepts::Graph
2.958 /// "Graph" concept.
2.959 - template <typename _Graph>
2.960 - class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<_Graph> > {
2.961 + template <typename GR>
2.962 + class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
2.963
2.964 public:
2.965
2.966 - typedef EdgeSetExtender<SmartEdgeSetBase<_Graph> > Parent;
2.967 + typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent;
2.968
2.969 typedef typename Parent::Node Node;
2.970 typedef typename Parent::Arc Arc;
2.971 typedef typename Parent::Edge Edge;
2.972
2.973 - typedef _Graph Graph;
2.974 + typedef GR Graph;
2.975
2.976 protected:
2.977
2.978 @@ -1334,7 +1334,7 @@
2.979 public:
2.980 typedef NodesImplBase Parent;
2.981
2.982 - NodesImpl(const Graph& graph, SmartEdgeSet& arcset)
2.983 + NodesImpl(const GR& graph, SmartEdgeSet& arcset)
2.984 : Parent(graph), _arcset(arcset) {}
2.985
2.986 virtual ~NodesImpl() {}
2.987 @@ -1374,15 +1374,15 @@
2.988 SmartEdgeSet& _arcset;
2.989 };
2.990
2.991 - NodesImpl nodes;
2.992 + NodesImpl _nodes;
2.993
2.994 public:
2.995
2.996 /// \brief Constructor of the EdgeSet.
2.997 ///
2.998 /// Constructor of the EdgeSet.
2.999 - SmartEdgeSet(const Graph& graph) : nodes(graph, *this) {
2.1000 - Parent::initalize(graph, nodes);
2.1001 + SmartEdgeSet(const GR& graph) : _nodes(graph, *this) {
2.1002 + Parent::initalize(graph, _nodes);
2.1003 }
2.1004
2.1005 /// \brief Add a new edge to the graph.
2.1006 @@ -1400,7 +1400,7 @@
2.1007 /// invalidated. It occurs when a node in the underlying graph is
2.1008 /// erased and it is not isolated in the EdgeSet.
2.1009 bool valid() const {
2.1010 - return nodes.attached();
2.1011 + return _nodes.attached();
2.1012 }
2.1013
2.1014 };
3.1 --- a/test/CMakeLists.txt Fri Jan 23 16:42:07 2009 +0000
3.2 +++ b/test/CMakeLists.txt Fri Feb 13 13:29:28 2009 +0100
3.3 @@ -10,7 +10,7 @@
3.4 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
3.5
3.6 SET(TESTS
3.7 -# adaptors_test
3.8 + adaptors_test
3.9 bfs_test
3.10 circulation_test
3.11 counter_test
3.12 @@ -18,7 +18,7 @@
3.13 digraph_test
3.14 dijkstra_test
3.15 dim_test
3.16 -# edge_set_test
3.17 + edge_set_test
3.18 error_test
3.19 graph_copy_test
3.20 graph_test
4.1 --- a/test/edge_set_test.cc Fri Jan 23 16:42:07 2009 +0000
4.2 +++ b/test/edge_set_test.cc Fri Feb 13 13:29:28 2009 +0100
4.3 @@ -33,7 +33,7 @@
4.4 using namespace lemon;
4.5
4.6 void checkSmartArcSet() {
4.7 - checkConcept<concepts::Digraph, SmartArcSet<concepts::Digraph> >();
4.8 + checkConcept<concepts::Digraph, SmartArcSet<ListDigraph> >();
4.9
4.10 typedef ListDigraph Digraph;
4.11 typedef SmartArcSet<Digraph> ArcSet;
4.12 @@ -99,7 +99,7 @@
4.13 }
4.14
4.15 void checkListArcSet() {
4.16 - checkConcept<concepts::Digraph, SmartArcSet<concepts::Digraph> >();
4.17 + checkConcept<concepts::Digraph, SmartArcSet<ListDigraph> >();
4.18
4.19 typedef ListDigraph Digraph;
4.20 typedef ListArcSet<Digraph> ArcSet;
4.21 @@ -179,7 +179,7 @@
4.22 }
4.23
4.24 void checkSmartEdgeSet() {
4.25 - checkConcept<concepts::Digraph, SmartEdgeSet<concepts::Digraph> >();
4.26 + checkConcept<concepts::Digraph, SmartEdgeSet<ListDigraph> >();
4.27
4.28 typedef ListDigraph Digraph;
4.29 typedef SmartEdgeSet<Digraph> EdgeSet;
4.30 @@ -263,7 +263,7 @@
4.31 }
4.32
4.33 void checkListEdgeSet() {
4.34 - checkConcept<concepts::Digraph, ListEdgeSet<concepts::Digraph> >();
4.35 + checkConcept<concepts::Digraph, ListEdgeSet<ListDigraph> >();
4.36
4.37 typedef ListDigraph Digraph;
4.38 typedef ListEdgeSet<Digraph> EdgeSet;