Graph matching problem and maximum flow problem (II.)--Ford-fulkerson method for maximum flow problem

Source: Internet
Author: User

This article undertakes the previous article, mainly explains the Ford-fulkerson solution of the maximal flow problem. However, this is a method, not an algorithm, because it contains several implementations with different run times. The method relies on three important ideas: residual networks, augmented paths and cuts. This article will cover this in more detail, and we'll provide a Java implementation of this approach in the next article.

Before introducing three kinds of concepts, we introduce the basic idea of the Ford-fulkerson method first. The first thing to know is that Ford-fulkerson is an iterative approach. At the beginning, all u,v belong to V,f (u,v) =0 (where F (u,v) represents the current traffic of the side of U to V), that is, the value of the initial state stream is 0. In each iteration, you can increase the stream value by looking for an "augmented path". The augmented path can be seen as a path from the source point S to the meeting point T, where more flows can be pressed along the path, thus increasing the value of the stream. Repeat the process until the augmented path is found.

For example, as shown in the figure, each red line represents an augmented path, and the current flow from S to T is 3.


Of course, this is not the maximum flow of the network, according to the algorithm to find the augmented path, we can actually continue to find the augmented path, the final maximum flow network as shown in the figure below, the maximum flow is 4.


Next we'll show you how to find the augmented path. Before we introduce the augmented path, we first need to introduce the concept of a residue network.

One, the residual network

As the name implies, a residual network is a network of a given network and a stream that corresponds to a stream that can accommodate it. Specifically, it is assumed that a network g= (v,e), its source point S, the meeting point T. Set F to a stream in G, corresponding to the stream of vertex u to Vertex v. Without exceeding C (u,v) (C stands for Edge capacity), the additional network traffic that can be pressed from u to V is the residual capacity of the Edge (U,V) (residual capacity), as defined below:

R (u,v) =c (U,v)-F (u,v)

For example, suppose (u,v) that the current flow is 3/4, that is, C (u,v) =4,f (u,v) = 3, then r (u,v) = 1.

We know that there is such a rule in the network flow. From U to v already has 3 unit flow, then from the opposite direction, that is, from V to u have 3 units of residual network, then R (v,u) = 3. It can be understood that from U to v there are 3 units of flow, then from V to u have the ability to press the 3 units of traffic back.

Let's take a concrete look at an example, as shown in the following diagram: a streaming network


The corresponding residual network is:


Second, the augmented path

After understanding the residual network, let's introduce the augmented path. Known as a stream network g and flow F, the augmented path p is a simple path from S to T in its residual network GF. Image of the understanding of the existence of a path from S to T does not violate the capacity of the edge, to this path into the flow, you can increase the flow of the entire network value. In the residual network above, there is an augmented path:


It can press into 4 units of traffic, after pressing, we get a new stream network, its traffic than the original flow network to 4 more. At this point we continue to find the augmented path in the same way on the new streaming network until it is not found. At this point we get a maximum network flow.

Third, the cutting of the flow network

The above is just a description of the method, but how to prove that when you can no longer find the augmented path, it proves that the current network is the largest flow network. This requires the maximum flow minimum cut theorem.

Firstly, the concept of cutting is introduced. The Cut (s,t) of the Stream network G (v,e) divides the V into S and t=v-s, making s belongs to the s,t of T. The capacity of a cut (s,t) is the sum of the capacity (in the direction) from the set S to all the sides of the set T (not the opposite direction, which must be s-àt). If f is a stream, then the net flow through the cut (S,T) is defined as F (s,t) (including the inverse, the positive value of the sàt, negative values of t->s). Continue with the example above and draw a cut, as shown in the following illustration:


The cut capacity is C (u,w) +c (v,x) =26

The current flow network through cut net flow is F (u,w) +f (v,x)-F (w,v) =12+11-4=19

Obviously, we have to any one cut, through the cut the upper bound of the net flow is the capacity of the cut, that is impossible to exceed the cut capacity. So the maximum flow of the network must not exceed the minimum cut of the network.

But what does this have to do with the augmented path on the residual network?

First, we must understand a feature that, according to the linear programming representation of the maximum flow problem mentioned in the previous article, mentions that the principle of flow-net traffic conservation, according to this principle we can know that the arbitrary cut of the network, its net flow is equal. Concrete proof is not difficult, can be through the image of the following figure under the understanding,


Compared to the above cut, the set S is less u and V, the net flow from the source point S to the set T flows to u and V, whereas in the previous cut, the flow of the set S to the set T is equal to the net flow of U and V to the set T. Where W also has a flow to the U and V, and this shunt can not flow to the source point S, because there is no path, so finally this portion of traffic plus s to u and V flow, between U and V in any case each other flow, eventually flow to set T, so this flow value is equal to the value of S flow to u and v. The analogy of s to a faucet, u and V flows elsewhere, is from S, and it cannot create water itself. So the net flow of arbitrary cut is equal.

Everything is ready now to prove that f is the maximum flow of G when the remaining network GF does not include an augmented path.

Suppose GF does not include an augmented path, that is, GF does not contain paths from S to V, defines a path from S to V in S={V:GF, which is the set of points that GF can have access to, obviously this set does not include T, because s to T does not have a path. At this time, we make t=v-s. Then (S,T) is a cut. As shown in the following illustration:


So, for vertex u belongs to s,v belongs to T, there is f (u,v) =c (u,v). Otherwise (U,V) there is residual flow, so s to u plus u to v to form a path of S to V, so v must belong to S, contradiction. So this indicates that the current stream F is equal to the current cut capacity, so f is the maximum flow.

In the next article, we'll give the Java implementation.

Reference: "Introduction to Algorithms", "Combinatorial mathematics"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.