"Algorithm problem combat strategy"-chaper32-network flow

Source: Internet
Author: User

Basic Network Flow Model:

In the preliminary application of graph theory, the two most common concerns, the length of the path in the image, that is, the shortest path problem we often call, and the other is called "flow problem".

Basic concepts of flow issues:

First, give a picture.

In fact, the so-called "network Flow", its model is very practical. We see the graph as a computer network structure. In this figure, S is called the source point and T is called the sink point. The remaining source in this diagram represents the network device, and the edge of the connecting vertex represents the data cable that connects the two devices, and the weight of the edge represents the maximum data that the cable can transmit.

First we should be able to notice that the forward path <s,t> is a transmission route, and the size of the stream that transmits the data x, satisfies x = min{|e| | e∈<s,t>},|e| represents the weight of the edge e. This is well understood, and it is based on basic physical reality.

Through the knowledge we have learned, it is easy to find a path with the largest <s,t>, because we know the shortest path how to ask, the longest road is the same. But finding only one of the longest paths here is obviously not enough to meet our needs. Because we found that in a graph structure, we only transfer through a longest path, often not as many relatively short paths for "joint transfer" effect is good, so the problem we are facing now is how to find a network flow model of the maximum flow?

Before we solve this problem, we will first make a more quantitative description of this model.

Here there are two vertex u,v, defined C (u,v) representing the capacity from U to V, and F (u,v) represents the actual flow from U to v. Based on this definition, we can see that the flow of the network is bound to meet several properties as follows:

(1) Capacity limitation: F (u,v) ≤c (u,v)

(2) Flow symmetry: f (u,v) =-F (v,u)

(3) Flow conservation: for vertex u, all flows through that point are 0

Ford-fulkerson algorithm for solving the maximum flow:

We can traverse all the paths <s,t>, and then record the total traffic, but then we face a problem, if in this process we visit a side then mark no longer access, for some side, when F (u,v) <<c (u,v) When the waste of resources, does not well reflect the "best" strategy. So here we have to naturally draw a new amount of r<u,v> used to represent the remaining flow space of U to V, that is, the following equation is established.

R (U,v) = f (u,v) –c (u,v).

So we can make up for the flaws in each iteration by simply making changes to the R value on each side.

However, we can not guarantee the optimality of the process, such as the following counter example.

(The numerator in 0/2 represents the actual flow, and the denominator represents the capacity)

Can see the real line callout out of the current does not meet the maximum flow requirements of the path, in the face of this "fork situation", the choice is often "blocked access", how should we deal with it?

Here we skillfully use the directionality of the maximum flow. For example, when a path is isolated in isolation, we assume that B to a has a path, why is it possible to do so? Because if we want to ask R (B,a), we will find R (b,a) =f (b,a) –c (b,a) = 0– (-1) = 1. This means that there is no path to the <b,a> route, but now there is a size of 1 of the remaining traffic? Because the flow reduction in <a,b> here is equivalent to the <b,a> flow increase, the previous <a,b> flow is exactly 1. So we're going to get the <s,b,a,t> path the next time we're looking for access <s,t>, At the same time we found that the flow of data between <a,b> and <b,a> is meaningless, so we can eliminate the path <a,b>, and through this "imaginary flow path" equivalent method, we can well solve the search output stream <s,t > may cause a "barrier road" problem.

"Algorithm problem combat strategy"-chaper32-network flow

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.