Redesigned CapacityScaling algorithm with almost the same interface.
The new version does not use the ResidualGraphAdaptor for performance reasons.
Scaling can be enabled and disabled with a parameter of the run() function.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2007
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #ifndef LEMON_LIST_GRAPH_H
20 #define LEMON_LIST_GRAPH_H
24 ///\brief Virtual map support.
28 ///Base class of the virtual maps.
29 template<class K, class V>
39 virtual Value operator[](const Key &) const { return Value();}
41 virtual void set(const Key &,const Value &) {}
44 ///Base class of the virtual reference maps.
45 template<class K, class V>
55 virtual Value& operator[](Key &) = 0;
57 virtual Value& operator[](const Key &) const = 0;
59 virtual void set(const Key &,const Value &) = 0;
62 ///Makes a virtual map from a \ref concepts::ReadMap "ReadMap"
63 template<class M, class K=typename M::Key,class V=typename M::Value>
64 class VReadMap : public VMapBase<K,V>
69 VReadMap(const M &m) : map(m) {}
70 virtual Value operator[](const Key &k) const { return map[k];}
73 ///Function interface for \ref VReadMap.
74 template<class M, class K=typename M::Key,class V=typename M::Value>
75 vReadMap(const M& m) {return VReadMap<M,K,V>(m);}
77 ///Makes a virtual map from a \ref concepts::WriteMap "WriteMap"
78 template<class M, class K=typename M::Key,class V=typename M::Value>
79 class VWriteMap :public VMapBase<K,V>
84 VWriteMap(M &m) : map(m) {}
85 virtual void set(const Key &k,const Value &v) { map.set(k,v);}
88 ///Function interface for \ref VWriteMap.
89 template<class M, class K=typename M::Key,class V=typename M::Value>
90 vWriteMap(const M& m) {return VReadMap<M,K,V>(m);}
92 ///Makes a virtual map from a \ref concepts::ReadWriteMap "ReadWriteMap"
93 template<class M, class K=typename M::Key,class V=typename M::Value>
94 class VReadWriteMap :public VMapBase<K,V>
99 VReadWriteMap(M &m) : map(m) {}
100 virtual Value operator[](const Key &k) const { return map[k];}
101 virtual void set(const Key &k,const Value &v) { map.set(k,v);}
104 ///Function interface for \ref VReadWriteMap.
105 template<class M, class K=typename M::Key,class V=typename M::Value>
106 vReadWriteMap(const M& m) {return VReadMap<M,K,V>(m);}