# HG changeset patch # User marci # Date 1078140790 0 # Node ID 6364b07f8cd4da337893df04874095af7ef40257 # Parent e342e66d9762226e8bb2662646a3d05025f0bab9 ResGraph3::EdgeMap diff -r e342e66d9762 -r 6364b07f8cd4 src/work/edmonds_karp.hh --- a/src/work/edmonds_karp.hh Fri Feb 27 14:20:47 2004 +0000 +++ b/src/work/edmonds_karp.hh Mon Mar 01 11:33:10 2004 +0000 @@ -452,19 +452,38 @@ int id(NodeIt v) const { return G.id(v); } - template + template class NodeMap { - typename Graph::NodeMap node_map; + typename Graph::NodeMap node_map; public: NodeMap(const ResGraph3& _G) : node_map(_G.G) { } - NodeMap(const ResGraph3& _G, S a) : node_map(_G.G, a) { } - void set(NodeIt nit, S a) { node_map.set(nit, a); } - S get(NodeIt nit) const { return node_map.get(nit); } + NodeMap(const ResGraph3& _G, T a) : node_map(_G.G, a) { } + void set(NodeIt nit, T a) { node_map.set(nit, a); } + T get(NodeIt nit) const { return node_map.get(nit); } + }; + + template + class EdgeMap { + typename Graph::EdgeMap forward_map, backward_map; + public: + EdgeMap(const ResGraph3& _G) : forward_map(_G.G), backward_map(_G.G) { } + EdgeMap(const ResGraph3& _G, T a) : forward_map(_G.G, a), backward_map(_G.G, a) { } + void set(EdgeIt e, T a) { + if (e.out_or_in) + forward_map.set(e.out, a); + else + backward_map.set(e.in, a); + } + T get(EdgeIt e) { + if (e.out_or_in) + return forward_map.get(e.out); + else + return backward_map.get(e.in); + } }; }; - template class MaxFlow { public: