Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modification to Maximum Flow Algorithm

I've tried to solve a question about the maximum-flow problem. I have one source and two sinks. I need to find a maximum flow in this network. This part is general max-flow. However, both targets have to get same amount of flow in this special version of the max-flow problem.

Is there anyone who can help me what should I do to do that?

like image 863
TheGost Avatar asked Jan 21 '14 20:01

TheGost


People also ask

Which algorithm is used for maximum flow problem?

Which algorithm is used to solve a maximum flow problem? Explanation: Ford-fulkerson algorithm is used to compute the maximum feasible flow between a source and a sink in a network.

How do you increase your maximum flow?

In some cases, you would need to increase the capacity of all edges of the graph in order to increase the max-flow. A way to test that is to compute the min-cut, then try and increase the capacity on one or several edges of this min-cut, and recompute the flow to compare to its previous value.

What is maximum flow algorithms how do you implement it?

It is defined as the maximum amount of flow that the network would allow to flow from source to sink. Multiple algorithms exist in solving the maximum flow problem. Two major algorithms to solve these kind of problems are Ford-Fulkerson algorithm and Dinic's Algorithm.


1 Answers

Let s be your source vertex and t1 and t2 the two sinks.

You can use the following algorithm:

  1. Use regular max-flow with two sinks, for example by connecting t1 and t2 to a super-sink via edges with infinite capacities. You now have the solution with maximum excess(t1) + excess(t2), but it might be imbalanced.

  2. If excess(t1) == excess(t2), you are done. Otherwise, w.l.o.g. let excess(t1) > excess(t2)

  3. Run another round of max-flow with source t1 and sink t2 in the residual network of step 1. Restrict the flow outgoing from t1 to c = floor((excess(t1) - excess(t2)) / 2), for example by introducing a super-source S connected to t1 via an edge with the given capacity c. Now, excess(t2) is the maximum flow you can send to both sinks.

  4. If you need to reconstruct the flow values for each edge, do another round of max-flow to transport the excess(t1) - excess(t2) leftover units of flow back to the source.

The complexity is that of your max-flow algorithm.

If you already know how to solve max-flow with lower-bound capacities, you can also binary search the solution, resulting in complexity O(log W * f) where W is the solution value and f is the max-flow complexity.

like image 154
Niklas B. Avatar answered Oct 16 '22 00:10

Niklas B.