Network flow problems

Source: Internet
Author: User

First, the maximum flow problem

Problem statement: Given a picture (n nodes, M-edge), each edge has a capacity, now need to transport some items from the node s (known as the source point) to the node T (called the sink point), can be transferred from other nodes, to find the maximum transport volume.

Before introducing the solution to the maximum flow problem, we introduce several concepts: reverse arc , residual network, augmented path, maximum flow theorem .

Reverse Arc :

If the capacity of the edge from U to V is C, and the flow F flows on this edge (called a forward arc ), it is equivalent to a 0 edge from V to u with a flow of-F, and this edge is a reverse arc .

The meaning of reverse arc: the effect of reverse arc is that the current selected arc will be discarded automatically when a better decision is made. The reason that the reverse arc has traffic is because if a forward arc is selected, the next time if there is a better strategy to make this f's traffic flow to the sink point, you can select the reverse arc, and the traffic F is revoked.

Residual network :

The residual network can be obtained by calculating the difference between the capacity and the flow rate on each edge of the graph (known as the residual capacity). Note that the number of edges in the remaining network may reach twice times the number of edges in the original image due to the presence of reverse edges .

Examples are as follows:

Observation Figure 4, in this state its residual network -5 is shown:

  augmented path :any forward path from S to T in the residual network corresponds to an augmented path in an original image--only the minimum of all residuals in the road is required, and the traffic on all sides of the corresponding edge is increased by D, a process called augmentation. 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. In this case, solving the maximum flow only requires finding the augmented path in the remaining network until there is no augmented path from S to T, which is the maximum flow. An efficient algorithm for solving the maximum flow problem isDinic,SAPAndISAP, see the template for details. TwoMaximum flow theorem of minimum cutCut: theOriginalAll vertices are divided into two sets S and t = v-s, where the source point S is in the set S, and the meeting point T is in the set T. If you remove the "starting point in S, the end point in T", you cannot reach T from S. Such a set partition (S,T) is called a cut, its capacity is defined as: ∑ (the capacity of the Edge (U, v) and), where U∈s, v∈t, that is, the starting point in S, the end point in T all sides of the capacity and. (All edges here do not include reverse arcs)Minimum Cut: All cuts in the graph, edge weights and minimal cuts.Maximum flow theorem of minimum cut: The maximum stream value is the minimum cut capacity!How to find the minimum cut: After the maximum flow, in the residual network starting from the source point S DFS, will be able to reach the point designator (C-f >0 Edge), the set of labeled nodes is S, the unlabeled node set is T, then the edge set [s, T] is the minimum cut.  The proof of the theorem is shown in Rujia, "Introduction to Algorithmic Competition (second edition)" (Purple book), page No. 370. Threeminimum cost maximum flow problemDescription of the problem: Suppose that each edge has a capacity limit, and there is a cost per unit of traffic. For the maximum total flow, the lowest total cost of the flow, that is, the minimum cost maximum flow. Algorithm: Similar to the maximum flow algorithm, but each time with the shortestSPFAAlgorithm rather than BFS to find the augmented path. As long as the initial flow is the minimum cost feasible flow under this traffic, the new stream after each augmentation is the minimum charge flow under the new traffic. In addition, the cost value can be positive and negative. See the template for the specific implementation method.

Network flow problems

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.