1378 class ForwardFilter { |
1378 class ForwardFilter { |
1379 const Graph* graph; |
1379 const Graph* graph; |
1380 const CapacityMap* capacity; |
1380 const CapacityMap* capacity; |
1381 const FlowMap* flow; |
1381 const FlowMap* flow; |
1382 public: |
1382 public: |
|
1383 void setGraph(const Graph& _graph) { graph=&_graph; } |
|
1384 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; } |
|
1385 void setFlow(const FlowMap& _flow) { flow=&_flow; } |
1383 ForwardFilter(const Graph& _graph, |
1386 ForwardFilter(const Graph& _graph, |
1384 const CapacityMap& _capacity, const FlowMap& _flow) : |
1387 const CapacityMap& _capacity, const FlowMap& _flow) : |
1385 graph(&_graph), capacity(&_capacity), flow(&_flow) { } |
1388 graph(&_graph), capacity(&_capacity), flow(&_flow) { } |
1386 bool operator[](const typename Graph::Edge& e) const { |
1389 bool operator[](const typename Graph::Edge& e) const { |
1387 return ((*flow)[e] < (*capacity)[e]); |
1390 return ((*flow)[e] < (*capacity)[e]); |
1393 class BackwardFilter { |
1396 class BackwardFilter { |
1394 const Graph* graph; |
1397 const Graph* graph; |
1395 const CapacityMap* capacity; |
1398 const CapacityMap* capacity; |
1396 const FlowMap* flow; |
1399 const FlowMap* flow; |
1397 public: |
1400 public: |
|
1401 void setGraph(const Graph& _graph) { graph=&_graph; } |
|
1402 void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; } |
|
1403 void setFlow(const FlowMap& _flow) { flow=&_flow; } |
1398 BackwardFilter(const Graph& _graph, |
1404 BackwardFilter(const Graph& _graph, |
1399 const CapacityMap& _capacity, const FlowMap& _flow) : |
1405 const CapacityMap& _capacity, const FlowMap& _flow) : |
1400 graph(&_graph), capacity(&_capacity), flow(&_flow) { } |
1406 graph(&_graph), capacity(&_capacity), flow(&_flow) { } |
1401 bool operator[](const typename Graph::Edge& e) const { |
1407 bool operator[](const typename Graph::Edge& e) const { |
1402 return (0 < (*flow)[e]); |
1408 return (0 < (*flow)[e]); |
1422 protected: |
1428 protected: |
1423 const CapacityMap* capacity; |
1429 const CapacityMap* capacity; |
1424 FlowMap* flow; |
1430 FlowMap* flow; |
1425 ForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter; |
1431 ForwardFilter<Graph, Number, CapacityMap, FlowMap> forward_filter; |
1426 BackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter; |
1432 BackwardFilter<Graph, Number, CapacityMap, FlowMap> backward_filter; |
|
1433 // ResGraphWrapper() : Parent(), |
|
1434 // capacity(0), flow(0) { } |
|
1435 // void setCapacityMap(const CapacityMap& _capacity) { |
|
1436 // capacity=&_capacity; |
|
1437 // } |
|
1438 // void setFlowMap(FlowMap& _flow) { |
|
1439 // flow=&_flow; |
|
1440 // } |
1427 public: |
1441 public: |
1428 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, |
1442 ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, |
1429 FlowMap& _flow) : |
1443 FlowMap& _flow) : |
1430 Parent(), capacity(&_capacity), flow(&_flow), |
1444 Parent(), capacity(&_capacity), flow(&_flow), |
1431 forward_filter(_graph, _capacity, _flow), |
1445 forward_filter(_graph, _capacity, _flow), |