I quit the pit for a long time, this article is not because of brush OJ and write summary, after all, chicken old age, 23333
Before I learned the network stream to look at the algorithm book and other people's blog then began to set up the board, and this time because the examination had to read the textbook theorem all over again, instantaneous to the maximum flow algorithm clearer.
1. Definition
Some knowledge to understand before learning the network stream algorithm.
1. For a forward network $g= (N, A, C) $, wherein the $c_{i,j}$ represents the arc $ (i,j) \in a$ capacity, and set $s,t$ as the point and the point of collection, so that
$$
x_{i,j}= flow through arc (I,J)
$$
2. A flow that satisfies the traffic limit is called a viable stream, where the limit is
(1) Conservation equation (for non-transceiver points, inflow flow equals outflow)
$$
\sum_j X_{i,j}-\sum_j x_{j,i}=\left\{
\begin{aligned}
+v,\,\,\, I =s \ \
0,\,\,\, I \neq s,t \ \
-v,\,\,\, I =t
\end{aligned}
\right.
$$
3. Set P is the non-directional path from S to T in G, if the arc $ (i,j) $ is in the direction from S to T, then it is called a forward arc, otherwise it is a back arc.
4. If there is a no-way p for G, there is a forward arc $ (i,j) $, $x _{i,j} < c_{i,j}$. There is a rear arc $ (i,j) $, $x _{i, j}>0$ is called the augmented path.
2. Algorithmic thinking
Take Ford-fulkerson algorithm as an example to introduce
The idea of the maximum flow algorithm is to find an augmented path, increase the flow value, make it a new feasible flow, until the augmented path is not found.
But why is the augmented road?
That's because the augmented road has only the following two kinds of conditions, can increase the flow
1. The augmented road is a forward arc.
The black number in the figure indicates the edge capacity, and the red number indicates the existing traffic. With.
In this case, the direct increase in traffic on each side is good.
2. The augmented road has a back arc.
This situation is the most serious in the network flow.
For forward arcs, an increase in the flow of a unit, for the back arc of the flow of the reduction of one unit.
Why did you do it? Look at the arc $ (5,4) $, if we return the traffic on this arc, then the return of this part of the traffic can be increased to the arc $ (5,6) $, to maintain the node 5 traffic conservation, because the node 5 of the back stream, node 4 inflow of traffic will be reduced by one unit, but we put the node 4 front of the forward arc , so the conservation of node 4 is ensured, and the flow rate is increased.
Therefore, this feature of the back arc can be used to increase the flow of the augmented road.
In this way, all the conditions of the augmented path can be increased.
3. The theory of the algorithm proves that the following are the two main theorems of network flow:
1. Augmented road theorem: A feasible flow is the maximum flow when and only if there is no augmented path about it from S to T.
Prove:
First, the upper bounds of the maximum flow are calculated
Define an arc cut $ (s,t) $, where $s\in S, t\in t$ "arc Cut: Remove the set of edges that make the branch of the graph strongly connected strictly add, this refers to the removal of the point set of the graph n is divided into S and T two sets"
Then cut $ (s,t) $ of capacity definition for $c (s,t) =\sum_{i\in s}\sum_{j\in t}c_{i,j}$
Thus, the flow v from S to T is not greater than $c (s,t) $, i.e.
$$
V\leq C (s,t)
$$
Then prove that this feasible flow is the maximum flow of s to the point from S can be reached by the augmented path of the set of points, $T =n-s$, then can be obtained for arbitrary $i\in s and $j\in t$, has a forward arc is full flow state, the back arc is 0. (Since I to J there is no way to go, only these two states)
So there are
$$
V=\sum_{i\in s}\sum_{j\in t}x_{i,j}=\sum_{i\in s}\sum_{j\in t}c_{i,j}=c (s,t)
$$
The upper bound of the maximum stream guarantees that the maximum flow is reached at this time.
2. Maximum flow Minimum cut theorem: The maximum value of a $ (s,t) $ stream is the minimum capacity of $ (s,t) $ cut.
Prove
According to the previous proof, it is possible to know that the maximum flow is the lower bound of C (s,t), and it can be taken in the process of pushing, so the theorem is established.
Then all the theoretical work is done, and the rest is to DFS or BFS the network until the augmentation path is not found.
A simple understanding of the maximum flow algorithm and theory