zoukankan      html  css  js  c++  java
  • Notions of Flow Networks and Flows

    这篇随笔是对算法导论(Introduction to Algorithms, 3rd. Ed.)第26章 Maximum Flow的摘录。


    1. A flow network $G = (V, E )$ is a directed graph in which each edge $(u, v) in E$ has a nonnegative capacity $c(u,v) ge 0$. 

    2. We further require that if $E$ contains an edge $(u, v)$ then there is no edge $(v, u)$ in the reverse direction.

    3. We distinguish two vertices in a flow network: a source s and a sink t.

    4. If $(u, v) otin E$, then for convenience we define $c(u,v)=0$, and we disallow self-loops, hence, capacity can be viewed as a function $ccolon V imes V o R$.

    5. A flow in G is a real-valued function $f colon V imes V o R$ that satisfies the following two properties:

      Capacity constraint: For all $u, v in V$, we require  $0le f(u,v)le c(u,v)$

      Flow conservation: For all $uin V-{s,t}$, we require 

    [ sum_{vin V} f(v,u) = sum_{vin V}f(u,v)]

    6. The value | | of a flow f is defined as | f | =  ∑ (s, v) -  ∑ (v, s).

    7. In the maximum-flow problem, we are given a flow network G with source s and sink t, and we wish to find a flow of maximum value.

    8. A cut (S, ) of flow network G = (V, ) is a partion of V into S and T = V - S such that s S and t ∈ T.

    9. If  f  is a flow, then the net flow (S, ) across the cut (S, ) is defined to be

      (S, ) = ∑uS ∑vT  f (u, v) - ∑uS ∑vT (v, u).

    10. The capacity of the cut (S, T)  is defined to be 

      (S, ) = ∑uvT (u, v).

    11. A minimum cut of  a network is a cut whose capacity is minimum over all cuts of the network.

    12. Given a flow network G = (V, ) with source s and sink t. Let  f  be a flow in G, and consider a pair of vertices u, v ∈ V. We difine the residual capacity (induced by ) cf  (u, v) by

      cf  (u, v) =

            (u, v) - (u, v),  if (u, v) ∈ E

            (u, v),        if (v, u) ∈ E

            0,        otherwise

    13. Given a flow network G = (V, ) and a flow f, the residual network of G induced by f is Gf  = (V, Ef ) where

      Ef  = {(u, v) ∈ V × Vcf  ( u, v) > 0}

    14.  If  f  is a flow in G and f '  is a flow in  the corresponding residual network Gf, we define ff ', the augmentation of flow f  by f ', to be a function from V × V to R, defined by

    (f ' ) (u, v) =

            f (u, v) + f ' (u, v) - f ' (v, u)  if (u, v) ∈ E ,

            0                otherwise .

    15.(Lemma 26.1, pp. 717)

    Let G = (V, E) be a flow network with source s and sink t, and let  f  be a flow in G . Let Gf be the residual network of G induced by f , and let  f ' be a flow in Gf . Then, the function  f ↑ f ' defined above is a flow in G with value | f ↑ f ' | = | f | + | f | + | f ' |.

    Proof   We first verify that f ' obeys the capacity constraint for each edge in and flow conservation at each vertex in V - {, t}.

    For the capacity constraint, first observe that if (u, v) ∈ E, then cf (v, u) = f (u, v). Therefore, we have f ' (vu) ≤ cf (vu) = (uv), and hence

    f ↑ f ' ) (uv ) =  (uv) + f ' (uv) - f ' (v, u

            ≥  f (u, v) + f ' (u, v) - f (u, v)

                           =  f ' (u, v)

           ≥  0 .

    In addition,

    (f ↑ f ') (u, v

        = f (u, v) + f ' (u, v) - f ' (v, u)

        ≤ f (u, v) + f ' (u, v)

        ≤ f (u, v) + cf (u, v)

        = f (u, v) + c (u, v) - f (u, v)

        = c (u, v)

    For flow conservation, because both and f ' obey flow conservation, we have that for all ∈ V - {s, t},

    vVf ↑ f ' ) (u, v) = ∑vV ( f (u, v) + f ' (u, v) - f ' (v, u))

              = ∑vV f (u, v) + ∑v f ' (u, v) - ∑vV f ' (v, u)

              = ∑vV f (v, u) + ∑vV f ' (v, u) - ∑vV f ' (u, v)

              = ∑vVf (v, u) + f ' (v, u) - f ' (u, v) )

              = ∑vVf ↑ f ' ) (v, u) ,

    where the third line follows from the second line by flow conservation.

    Finally, we compute the value of f ' (recall how we define the value of a flow). Recall that we disallow antiparallel edges in G (but not in Gf ), and hence for each edge (s, v) ∈ V, we know that there can be an edge (s, v) or (v, s), but never both. We define V1 = { v : (s, v) ∈ E} to be the set of vertices with edges from s, and V2 = {v : (v, s) ∈ E} to be the set of vertices to s. We have V1  V2 ⊆ V and, because we disallow antiparallel edges, V1 ∩ V2 = ∅. We now compute

    | f ↑ f ' | = ∑vV ( f ↑ f ' ) (s, v) -  ∑vV ( f ↑ f ' ) (v, s)

        = ∑vV1 ( f ↑ f ' ) (s, v) - ∑vV2 ( f ↑ f ' ) (v, s) ,

    where the second line follows because ( f ↑ f ' ) (w, x) is 0 if (w, x) ∉ E. We now apply the definition of f ↑ f ' to the equation above, and then reorder and group terms to abtain

    f ↑ f ' | 

      = ∑vV1f (s, v) + f ' (s, v) - f ' (v, s)) - ∑vV2 ( f (v, s) + f ' (v, s) - f ' (s, v))

         = ∑vV1 f (sv) + ∑vV1 (sv) - ∑vV1 (v, s)

           - ∑vV2 f (vs) - ∑vV2 (vs) + ∑vV2 ' (sv)

      = ∑vV1 f (sv) - ∑vV2 f (vs

        + ∑vV1 (sv) + ∑vV2 ' (sv) - ∑vV1 (vs) - ∑vV2 (vs)

      = ∑vV1 f (sv) - ∑vV2 f (vs) + ∑vV1V2 (sv) - ∑vV1V2 (vs) .

      = ∑vV f (sv) - ∑vV f (vs) + ∑vV (sv) - ∑vV (vs)

      = | f | + | f ' | .

  • 相关阅读:
    tar命令,vi编辑器
    Linux命令、权限
    Color Transfer between Images code实现
    利用Eclipse使用Java OpenCV(Using OpenCV Java with Eclipse)
    Matrix Factorization SVD 矩阵分解
    ZOJ Problem Set
    Machine Learning
    ZOJ Problem Set
    ZOJ Problem Set
    ZOJ Problem Set
  • 原文地址:https://www.cnblogs.com/Patt/p/4866605.html
Copyright © 2011-2022 走看看