1.1 --- a/src/hugo/graph_wrapper.h Mon May 24 10:43:44 2004 +0000
1.2 +++ b/src/hugo/graph_wrapper.h Mon May 24 14:13:03 2004 +0000
1.3 @@ -1375,17 +1375,18 @@
1.4
1.5 template<typename Graph, typename Number,
1.6 typename CapacityMap, typename FlowMap>
1.7 - class ForwardFilter {
1.8 - const Graph* graph;
1.9 + class ResForwardFilter {
1.10 + // const Graph* graph;
1.11 const CapacityMap* capacity;
1.12 const FlowMap* flow;
1.13 public:
1.14 - void setGraph(const Graph& _graph) { graph=&_graph; }
1.15 + ResForwardFilter(/*const Graph& _graph, */
1.16 + const CapacityMap& _capacity, const FlowMap& _flow) :
1.17 + /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { }
1.18 + ResForwardFilter() : /*graph(0),*/ capacity(0), flow(0) { }
1.19 + //void setGraph(const Graph& _graph) { graph=&_graph; }
1.20 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; }
1.21 void setFlow(const FlowMap& _flow) { flow=&_flow; }
1.22 - ForwardFilter(const Graph& _graph,
1.23 - const CapacityMap& _capacity, const FlowMap& _flow) :
1.24 - graph(&_graph), capacity(&_capacity), flow(&_flow) { }
1.25 bool operator[](const typename Graph::Edge& e) const {
1.26 return ((*flow)[e] < (*capacity)[e]);
1.27 }
1.28 @@ -1393,17 +1394,18 @@
1.29
1.30 template<typename Graph, typename Number,
1.31 typename CapacityMap, typename FlowMap>
1.32 - class BackwardFilter {
1.33 - const Graph* graph;
1.34 + class ResBackwardFilter {
1.35 + //const Graph* graph;
1.36 const CapacityMap* capacity;
1.37 const FlowMap* flow;
1.38 public:
1.39 - void setGraph(const Graph& _graph) { graph=&_graph; }
1.40 + ResBackwardFilter(/*const Graph& _graph,*/
1.41 + const CapacityMap& _capacity, const FlowMap& _flow) :
1.42 + /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { }
1.43 + ResBackwardFilter() : /*graph(0),*/ capacity(0), flow(0) { }
1.44 + //void setGraph(const Graph& _graph) { graph=&_graph; }
1.45 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; }
1.46 void setFlow(const FlowMap& _flow) { flow=&_flow; }
1.47 - BackwardFilter(const Graph& _graph,
1.48 - const CapacityMap& _capacity, const FlowMap& _flow) :
1.49 - graph(&_graph), capacity(&_capacity), flow(&_flow) { }
1.50 bool operator[](const typename Graph::Edge& e) const {
1.51 return (0 < (*flow)[e]);
1.52 }
1.53 @@ -1418,32 +1420,42 @@
1.54 class ResGraphWrapper :
1.55 public SubBidirGraphWrapper<
1.56 Graph,
1.57 - ForwardFilter<Graph, Number, CapacityMap, FlowMap>,
1.58 - BackwardFilter<Graph, Number, CapacityMap, FlowMap> > {
1.59 + ResForwardFilter<Graph, Number, CapacityMap, FlowMap>,
1.60 + ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> > {
1.61 public:
1.62 typedef SubBidirGraphWrapper<
1.63 Graph,
1.64 - ForwardFilter<Graph, Number, CapacityMap, FlowMap>,
1.65 - BackwardFilter<Graph, Number, CapacityMap, FlowMap> > Parent;
1.66 + ResForwardFilter<Graph, Number, CapacityMap, FlowMap>,
1.67 + ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> > Parent;
1.68 protected:
1.69 const CapacityMap* capacity;
1.70 FlowMap* flow;
1.71 - ForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter;
1.72 - BackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter;
1.73 -// ResGraphWrapper() : Parent(),
1.74 -// capacity(0), flow(0) { }
1.75 -// void setCapacityMap(const CapacityMap& _capacity) {
1.76 -// capacity=&_capacity;
1.77 -// }
1.78 -// void setFlowMap(FlowMap& _flow) {
1.79 -// flow=&_flow;
1.80 + ResForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter;
1.81 + ResBackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter;
1.82 + ResGraphWrapper() : Parent(),
1.83 + capacity(0), flow(0) { }
1.84 + void setCapacityMap(const CapacityMap& _capacity) {
1.85 + capacity=&_capacity;
1.86 + forward_filter.setCapacity(_capacity);
1.87 + backward_filter.setCapacity(_capacity);
1.88 + }
1.89 + void setFlowMap(FlowMap& _flow) {
1.90 + flow=&_flow;
1.91 + forward_filter.setFlow(_flow);
1.92 + backward_filter.setFlow(_flow);
1.93 + }
1.94 +// /// \bug does graph reference needed in filtermaps??
1.95 +// void setGraph(const Graph& _graph) {
1.96 +// Parent::setGraph(_graph);
1.97 +// forward_filter.setGraph(_graph);
1.98 +// backward_filter.setGraph(_graph);
1.99 // }
1.100 public:
1.101 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity,
1.102 FlowMap& _flow) :
1.103 Parent(), capacity(&_capacity), flow(&_flow),
1.104 - forward_filter(_graph, _capacity, _flow),
1.105 - backward_filter(_graph, _capacity, _flow) {
1.106 + forward_filter(/*_graph,*/ _capacity, _flow),
1.107 + backward_filter(/*_graph,*/ _capacity, _flow) {
1.108 Parent::setGraph(_graph);
1.109 Parent::setForwardFilterMap(forward_filter);
1.110 Parent::setBackwardFilterMap(backward_filter);