Problem:
Suppose there is a graph, a source and a sink. Each edge has a capacity and an extra capacity that it can hold. If sink needs a defined amount of flow F
, find a total extra capacity needed E
so that maximum flow from source to sink is greater than or equal to F
and flow in each edge that has nonzero flow.
I don't know how to solve this variation of maximum flow problem. It is obvious that if maximum flow I find without extra capacities is greater than or equal to F
, then there is no need for extra capacity. If it is less than F
, should I add extra capacity in each edge one by one and find max flow again till I find the closest one to F
(if it is not enough, then take in pairs, triplets, etc.)? This solution seems inefficient to me.
EDIT:
Example:
Suppose source is node 0 and sink is node 5. Sink requires flow of 6 (F = 6)
. For the following format
(1st node, 2nd node), current capacity, extra capacity that can be added
we have following edges
0 1 3 0
0 3 3 0
1 2 3 0
1 3 2 0
2 4 4 0
2 5 2 2
3 4 2 1
4 5 3 1
Maximum flow from current capacities is 5 which is not enough for the sink (5 < F
). The extra capacity from 3 to 4 and 4 to 5 is required. So total extra capacity is 2 (E
= 2) and the flows are
0 1 3
0 3 3
1 2 3
2 4 1
2 5 2
3 4 3
4 5 4