1459 Parent::setGraph(_graph); |
1459 Parent::setGraph(_graph); |
1460 Parent::setForwardFilterMap(forward_filter); |
1460 Parent::setForwardFilterMap(forward_filter); |
1461 Parent::setBackwardFilterMap(backward_filter); |
1461 Parent::setBackwardFilterMap(backward_filter); |
1462 } |
1462 } |
1463 |
1463 |
|
1464 typedef typename Parent::Edge Edge; |
|
1465 |
1464 // bool forward(const Parent::Edge& e) const { return Parent::forward(e); } |
1466 // bool forward(const Parent::Edge& e) const { return Parent::forward(e); } |
1465 //bool backward(const Edge& e) const { return e.backward; } |
1467 //bool backward(const Edge& e) const { return e.backward; } |
1466 |
1468 |
1467 void augment(const typename Parent::Edge& e, Number a) const { |
1469 void augment(const Edge& e, Number a) const { |
1468 if (Parent::forward(e)) |
1470 if (Parent::forward(e)) |
1469 // flow->set(e.out, flow->get(e.out)+a); |
1471 // flow->set(e.out, flow->get(e.out)+a); |
1470 flow->set(e, (*flow)[e]+a); |
1472 flow->set(e, (*flow)[e]+a); |
1471 else |
1473 else |
1472 //flow->set(e.in, flow->get(e.in)-a); |
1474 //flow->set(e.in, flow->get(e.in)-a); |
1473 flow->set(e, (*flow)[e]-a); |
1475 flow->set(e, (*flow)[e]-a); |
1474 } |
1476 } |
1475 |
1477 |
1476 Number resCap(const typename Parent::Edge& e) const { |
1478 /// \deprecated |
|
1479 /// |
|
1480 Number resCap(const Edge& e) const { |
1477 if (Parent::forward(e)) |
1481 if (Parent::forward(e)) |
1478 // return (capacity->get(e.out)-flow->get(e.out)); |
1482 // return (capacity->get(e.out)-flow->get(e.out)); |
1479 return ((*capacity)[e]-(*flow)[e]); |
1483 return ((*capacity)[e]-(*flow)[e]); |
1480 else |
1484 else |
1481 // return (flow->get(e.in)); |
1485 // return (flow->get(e.in)); |
1482 return ((*flow)[e]); |
1486 return ((*flow)[e]); |
1483 } |
1487 } |
1484 |
1488 |
|
1489 /// \brief Residual capacity map. |
|
1490 /// |
|
1491 /// In generic residual graphs the residual capacity can be obtained as a map. |
|
1492 class ResCap { |
|
1493 protected: |
|
1494 const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>* res_graph; |
|
1495 public: |
|
1496 typedef Number ValueType; |
|
1497 typedef Edge KeyType; |
|
1498 ResCap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _res_graph) : |
|
1499 res_graph(&_res_graph) { } |
|
1500 Number operator[](const Edge& e) const { |
|
1501 if (res_graph->forward(e)) |
|
1502 // return (capacity->get(e.out)-flow->get(e.out)); |
|
1503 return (*(res_graph->capacity))[e]-(*(res_graph->flow))[e]; |
|
1504 else |
|
1505 // return (flow->get(e.in)); |
|
1506 return (*(res_graph->flow))[e]; |
|
1507 } |
|
1508 /// \bug not needed with dynamic maps, or does it? |
|
1509 void update() { } |
|
1510 }; |
|
1511 |
1485 }; |
1512 }; |
1486 |
|
1487 |
|
1488 |
1513 |
1489 |
1514 |
1490 template<typename Graph, typename Number, |
1515 template<typename Graph, typename Number, |
1491 typename CapacityMap, typename FlowMap> |
1516 typename CapacityMap, typename FlowMap> |
1492 class OldResGraphWrapper : public GraphWrapper<Graph> { |
1517 class OldResGraphWrapper : public GraphWrapper<Graph> { |