Maximum flow min-cut

Reprinted from: https://blog.csdn.net/a1781842634/article/details/79453071

Recently, I was looking at maxflow related materials. This article mainly introduces my understanding of maximum flow and minimum cut. The maximum flow was originally an algorithm for network flow, and later it was widely used in computer vision, such as Figure Cut. I feel that to understand an algorithm, one starts with the origin, then de-generalizes the problem, builds the model, and finally solves it. This article is to understand the algorithm from a novice's point of view. 

Let’s start with the simplest and first look at a graph:  there are 3 nodes S, a, T, the capacity of the edge [S, a] is 10, and the capacity of the edge [a, T] is 5. Send data to T, what is the maximum amount of data to be sent? It should be min(10,5)=5. If it exceeds 5, the [a,T] side cannot be accommodated, so it cannot be passed. The maximum flow at this time is 5, and the [a,T] side is a maximum flow of the graph . This picture can be imagined as water pipes from S to T, and a water pipe needs to be built. A is an intermediate station. The water pipe built from S to a can hold 10 units of water, and a to T can hold 5 units of water. Now some people don’t want to Let S to T pass water, then he has to cut the water pipe, so which water pipe should be cut? It is assumed that the cost of cutting the water pipe is proportional to the capacity of the water pipe. Obviously, he needs to cut the water pipe from a to T, but not the water pipe from S to a. At this time, the cut is the minimum cut, the capacity is 5, and the maximum flow is 5, so the maximum flow = the minimum cut. Of course this example is too simple to illustrate the general problem. Let's take a slightly complicated example:  from S to T, passing through two nodes a and b in the middle, what is the maximum flow at this time? First find a path [S,a,t] from S to T, the maximum flow of this path is min(2,3)=2, because the capacity above [S,a] has been used, so the path [S ,a,b,t] will not work. After cutting [S,a], the graph becomes the following form:  The graph is called residual network or residual graph, and then find the path from S to t [S,b] ,t], the maximum flow of the path is min(3,6)=3. After cutting [b,t], the figure is as follows:  At this time, there is no feasible path from S to t, and the search for the maximum flow ends . The maximum flow at this time is 2+3=5, and the sum of the capacity of the cut edges is 2+3=5, that is, the maximum flow = the minimum cut. 
write picture description here  


write picture description here  


Write picture description here]![Write picture description here  

write picture description here  

We can already understand the general meaning of the maximum flow and the minimum cut from the two examples, and we also found that the maximum flow and the minimum cut are indeed equal. Only from these two small examples, it is proved that the maximum flow and the minimum cut are absolutely not strict, and the strict mathematical proof can be googled for relevant information. Looking back, what is the maximum flow? If we take delivery as an example, where feasible, the maximum amount of goods that can be delivered from one node to another is the maximum flow. For example, assuming that the marble starts from S and rolls to t automatically, the arrow direction is a downhill road. Without considering time and space (that is, imagine the marble as a particle), the path can accommodate The maximum amount of marbles is the maximum flow, and the minimum cut is to cut off the sides with the same amount of marbles and the same capacity, and the obtained cut is the minimum cut. Obviously, the maximum flow = the minimum cut, because the maximum flow is completely determined by the path and capacity. Decide. After cutting these edges, the marble cannot roll from S to t.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325643822&siteId=291194637