Transferred from: http://www.cnblogs.com/kuangbin/archive/2011/07/26/2117636.html
Figure-1
1, in this transport network, the source point S and the meeting point T are 1, 7, the capacity of each side is C (u,v). The red dashed line in the figure shows a viable flow. The standard diagram Method-2 shows:
where P (u,v)/C (U,V) represents the actual traffic and maximum capacity of the edge respectively.
About Maximum Flow
Familiar with what is the network flow, the maximum flow is also very good understanding. is for arbitrary u∈v-{s}, so that P (s,u) and reach the maximum. Above the transport network, the maximum flow is 3: Maxflow=p (+p) (1,3) =2+1=3.
Before introducing the maximum flow problem, we introduce several concepts: Residual network, augmented path, inverse arc, maximum flow theorem and Ford-fulkerson method for maximum flow.
Residual network augmented path reverse arc
Observe-4, in this state its residual network-5 is shown:
Perhaps now that you know what a residual network is, for a network that has found a path from S to T, simply update the value of C (u,v) to C (u,v)-P (u,v) on this path, and add the reverse arc C (v,u). The corresponding augmentation path path is a simple path from S to T on the residual network. Figure 4 1,2,4,7 is an augmented path, and of course 1,3,4,7.
Also, before doing anything, the original graph is a residual network, and it's just not doing any updates.
Maximum flow theorem
If no augmented path is found on the remaining network, the current stream is the maximum stream, and conversely, if the current stream is not the maximum, there must be an augmented path.
Ford-fulkerson Method
After introducing the above concepts, we can use the Ford-fulkerson method to find the maximum flow. Why is called the Ford-fulkerson method rather than the algorithm, because this method can be implemented in a variety of ways, not the only way. An algorithm for calculating augmented path p based on breadth First search (BFS) is presented below: Edmonds-karp algorithm.
The algorithm flow is as follows:
Set Queue Q: Stores the currently inaccessible nodes, the first node of the team after the team, become checked punctuation;
Path array: Stores the augmented path of the node that is currently visited;
Flow array: The amount of improved flow after the BFS traversal is stored;
Repeat:
Path empty;
Source point S enters Path and q,path[s]<-0,flow[s]<-+∞;
While q non-null and sink point T is not accessed do
Begin
Team top vertex u out pair;
For each arc starting from U (u,v) do
If v is not accessed and arcs (u,v) flow can be improved;
Then Flow[v]<-min (Flow[u],c[u][v]) and V queue and path[v]<-u;
End while
If (meeting point T has been accessed)
Then construct the residual network from the meeting point t along path;
Until meeting Point T was not accessed
"Go" max Stream ek algorithm