university of cambridge · multiple sources and multiple sinks (figure 26.1) 26.1 flow networks 713...

159
6.6: Maximum flow Frank Stajano Thomas Sauerwald Lent 2015 s 2 3 4 5 t Graph G =(V , E, c): 8/10 8/9 8/8 2/4 8/10 10/10 9/10 0/2 6/6 3/4 7/8 9/9 9/10 10/10 s 2 3 4 5 t Residual Graph Gf =(V , Ef , cf ): 10 2 8 2 6 2 2 8 1 8 2 8 10 |f | = 18

Upload: others

Post on 19-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

  • 6.6: Maximum flowFrank Stajano Thomas Sauerwald

    Lent 2015

    Illustration of the Ford-Fulkerson Method

    s

    2

    3

    4

    5 t

    Graph G = (V , E , c):

    0/10

    0/10

    0/2 0/6

    0/4

    0/8

    0/9

    0/10

    0/10

    ⇠⇠

    0/10 ��0/8

    ⇠⇠0/108/1

    0

    0/10

    0/2 0/6

    0/4

    8/8

    0/9

    0/10

    8/10

    ⇠⇠

    8/10 ��0/2

    ��0/9⇠⇠8/10

    10/10

    0/10

    2/2 0/6

    0/4

    8/8

    2/9

    0/10

    10/10⇠⇠0/10��2/9

    ��0/6⇠⇠0/1010

    /10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10⇠⇠6/10

    ��2/2

    ��0/4

    ⇠⇠6/1010/1

    0

    8/10

    0/2 6/6

    2/4

    8/8

    8/9

    8/10

    10/10

    ⇠⇠8/10 ��8/9

    ��8/8

    ��2/4⇠⇠8/1010

    /10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    s

    2

    3

    4

    5 t

    Residual Graph Gf = (V , Ef , cf ):

    10

    10

    2 6

    4

    8

    910

    10

    2

    8

    10

    2 6

    4

    8

    910

    2

    8

    10

    10

    2 6

    4

    8

    7

    2

    1010

    10

    4

    6

    2 6

    4

    8

    1

    8

    4

    610

    10

    2

    8

    2 6

    2

    2

    8

    1

    8

    2

    810

    10

    1

    9

    2 6

    1

    3

    7

    1

    9

    1

    910

    |f | = 0|f | = 8|f | = 10|f | = 16

    |f | = 18

    |f | = 19

    Is this a max-flow?

    6.6: Maximum flow T.S. 9

  • Outline

    Recap

    Max-Flow Min-Cut Theorem

    Analysis of Ford-Fulkerson

    6.6: Maximum flow T.S. 2

  • History of the Maximum Flow Problem [Harris, Ross (1955)]

    21 -C

    -0

    5

    0! E

    0

    70 =

    In 4'

    oS 0

    'ma

    0

    0 O

    f

    0

    3

    (a ~

    0

    za

    ~0aa)

    On,

    _Z

    Z

    a_

    w 0>a

    LL

    ,,

    a cc

    cCfl

    SECR

    ET R

    7-

    Maximum Flow is 163,000 tons per day!

    6.6: Maximum flow T.S. 3

  • Multiple Sources and Multiple Sinks (Figure 26.1)26.1 Flow networks 713

    10

    (a)

    12

    58

    147

    112

    3

    15

    6

    20

    1318

    1012

    58

    147

    112

    3

    15

    6

    20

    1318

    ∞ ∞

    s1 s1

    s2 s2

    s3s3

    s4 s4

    s5s5

    t1 t1

    t2t2

    t3 t3

    (b)

    s t

    Figure 26.3 Converting a multiple-source, multiple-sink maximum-flow problem into a problemwith a single source and a single sink. (a) A flow network with five sources S D fs1; s2; s3; s4; s5gand three sinks T D ft1; t2; t3g. (b) An equivalent single-source, single-sink flow network. We adda supersource s and an edge with infinite capacity from s to each of the multiple sources. We alsoadd a supersink t and an edge with infinite capacity from each of the multiple sinks to t .

    26.1-2Extend the flow properties and definitions to the multiple-source, multiple-sinkproblem. Show that any flow in a multiple-source, multiple-sink flow networkcorresponds to a flow of identical value in the single-source, single-sink networkobtained by adding a supersource and a supersink, and vice versa.26.1-3Suppose that a flow network G D .V; E/ violates the assumption that the networkcontains a path s ! ! ! t for all vertices ! 2 V . Let u be a vertex for which thereis no path s ! u ! t . Show that there must exist a maximum flow f in G suchthat f .u; !/ D f .!; u/ D 0 for all vertices ! 2 V .

    6.6: Maximum flow T.S. 4

  • Multiple Sources and Multiple Sinks (Figure 26.1)26.1 Flow networks 713

    10

    (a)

    12

    58

    147

    112

    3

    15

    6

    20

    1318

    1012

    58

    147

    112

    3

    15

    6

    20

    1318

    ∞ ∞

    s1 s1

    s2 s2

    s3s3

    s4 s4

    s5s5

    t1 t1

    t2t2

    t3 t3

    (b)

    s t

    Figure 26.3 Converting a multiple-source, multiple-sink maximum-flow problem into a problemwith a single source and a single sink. (a) A flow network with five sources S D fs1; s2; s3; s4; s5gand three sinks T D ft1; t2; t3g. (b) An equivalent single-source, single-sink flow network. We adda supersource s and an edge with infinite capacity from s to each of the multiple sources. We alsoadd a supersink t and an edge with infinite capacity from each of the multiple sinks to t .

    26.1-2Extend the flow properties and definitions to the multiple-source, multiple-sinkproblem. Show that any flow in a multiple-source, multiple-sink flow networkcorresponds to a flow of identical value in the single-source, single-sink networkobtained by adding a supersource and a supersink, and vice versa.26.1-3Suppose that a flow network G D .V; E/ violates the assumption that the networkcontains a path s ! ! ! t for all vertices ! 2 V . Let u be a vertex for which thereis no path s ! u ! t . Show that there must exist a maximum flow f in G suchthat f .u; !/ D f .!; u/ D 0 for all vertices ! 2 V .

    6.6: Maximum flow T.S. 4

  • Residual Graph

    Edge e = (u, v) ∈ Eflow f (u, v) and capacity c(u, v)

    Original Edge

    cf (u, v) =

    c(u, v)− f (u, v) if (u, v) ∈ E ,f (v , u) if (v , u) ∈ E ,0 otherwise.

    Residual Capacity

    Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph

    Graph G:

    u v6/17

    Residual Gf :

    u v

    11

    6

    6.6: Maximum flow T.S. 5

  • Residual Graph with anti-parallel edges

    Edge e = (u, v) ∈ E (& possibly e′ = (v , u) ∈ E)flow f (u, v) and capacity c(u, v)

    Original Edge

    For every pair (u, v) ∈ V × V ,

    cf (u, v) = c(u, v)− f (u, v).

    Residual Capacity

    Gf = (V ,Ef , cf ), Ef := {(u, v) : cf (u, v) > 0}Residual Graph

    Graph G:

    u v

    6/17

    2/4

    Residual Gf :

    u v

    ??

    ??

    17-(6-2)

    4-(2-6)

    13

    8

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/101/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/6

    1/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/6

    1/8

    1/121/14

    1/6

    0/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/6

    0/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • Example of a Residual Graph (Handout)

    Flow network Gs

    2

    3

    4

    5

    t

    1/14

    1/6

    2/3

    4/105/12

    5/8

    4/7

    3/4

    1/3

    3/7

    3/4

    1/3

    3/7

    2/3

    0/2

    2/6

    2/3

    0/2

    2/6

    4/105/12

    0/101/12

    0/10

    1/12

    5/8

    4/7

    1/8

    0/7

    1/8

    0/7

    1/8

    1/121/14

    1/61/8

    1/121/14

    1/60/8

    0/120/14

    0/6

    0/8

    0/120/14

    0/6

    Residual Graph Gfs

    2

    3

    4

    5

    t

    1111

    131

    51

    78

    13

    21

    34

    1 2

    By successively eliminating cycles we can sim-plify and reduce the “transportation” cost of a flow.

    Comment on anti-parallel edges:You should know about this possibility

    In the following proofs we will disallow anti-parallel edges(for convenience)

    6.6: Maximum flow T.S. 5

  • The Ford-Fulkerson Method (“Enhanced Greedy”)

    0: def fordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    Augmenting path: Pathfrom source to sink in Gf

    Questions:How to find an augmenting path? XDoes this method terminate?If it terminates, how good is the solution?

    6.6: Maximum flow T.S. 6

  • Outline

    Recap

    Max-Flow Min-Cut Theorem

    Analysis of Ford-Fulkerson

    6.6: Maximum flow T.S. 10

  • From Flows to Cuts

    A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .

    The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :

    c(S,T ) =∑

    u∈S,v∈T

    c(u, v) =∑

    (u,v)∈E(S,T )

    c(u, v)

    A mininum cut of a network is a cut whose capacity is minimum overall cuts of the network.

    Cut

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) =

    10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .

    The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :

    c(S,T ) =∑

    u∈S,v∈T

    c(u, v) =∑

    (u,v)∈E(S,T )

    c(u, v)

    A mininum cut of a network is a cut whose capacity is minimum overall cuts of the network.

    Cut

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) =

    10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :

    c(S,T ) =∑

    u∈S,v∈T

    c(u, v) =∑

    (u,v)∈E(S,T )

    c(u, v)

    A mininum cut of a network is a cut whose capacity is minimum overall cuts of the network.

    Cut

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) =

    10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :

    c(S,T ) =∑

    u∈S,v∈T

    c(u, v) =∑

    (u,v)∈E(S,T )

    c(u, v)

    A mininum cut of a network is a cut whose capacity is minimum overall cuts of the network.

    Cut

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    A cut (S,T ) is a partition of V into S and T = V \ S such that s ∈ Sand t ∈ T .The capacity of a cut (S,T ) is the sum of capacities of the edgesfrom S to T :

    c(S,T ) =∑

    u∈S,v∈T

    c(u, v) =∑

    (u,v)∈E(S,T )

    c(u, v)

    A mininum cut of a network is a cut whose capacity is minimum overall cuts of the network.

    Cut

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 168 + 8− 6 + 6 = 16

    6.6: Maximum flow T.S. 11

  • From Flows to Cuts

    Let f be a flow with source s and sink t , and let (S,T ) be any cut of G.Then the value of the flow is equal to the net flow across the cut, i.e.,

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    Flow Value Lemma (Lemma 26.4)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • From Flows to Cuts

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • From Flows to Cuts

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    |f | =

    ∑w∈V

    f (s,w) =∑u∈S

    ( ∑(u,w)∈E

    f (u,w)−∑

    (w,u)∈E

    f (w , u))

    =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • From Flows to Cuts

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    |f | =∑w∈V

    f (s,w)

    =∑u∈S

    ( ∑(u,w)∈E

    f (u,w)−∑

    (w,u)∈E

    f (w , u))

    =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • From Flows to Cuts

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    |f | =∑w∈V

    f (s,w) =∑u∈S

    ( ∑(u,w)∈E

    f (u,w)−∑

    (w,u)∈E

    f (w , u))

    =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • From Flows to Cuts

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u).

    |f | =∑w∈V

    f (s,w) =∑u∈S

    ( ∑(u,w)∈E

    f (u,w)−∑

    (w,u)∈E

    f (w , u))

    =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    s

    2

    3

    4

    5 t

    Graph G = (V ,E , c):

    10

    10

    2 6

    4

    8

    9

    10

    10

    c({s, 3}, {2, 4, 5, t}) = 10 + 9 = 19

    |f | = 16

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    10− 2 + 8 = 16

    8 + 8− 6 + 6 = 166.6: Maximum flow T.S. 11

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut.

    Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    10

    102 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    10

    102 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10

    c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    10

    102 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v)

    = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Weak Duality betwen Flows and Cuts

    Let f be any flow and (S,T ) be any cut. Then the value of f is boundedfrom above by the capacity of the cut (S,T ), i.e.,

    |f | ≤ c(S,T ).

    Weak Duality (Corollary 26.5)

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    ≤∑

    (u,v)∈E(S,T )

    f (u, v)

    ≤∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T ).

    |f | = 10− 2 + 8 = 16

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/8

    8/9

    6/10

    10/10c(S,T )=10+9=19

    s

    2

    3

    4

    5 t

    1010

    2 6

    4

    8

    9

    10

    10

    6.6: Maximum flow T.S. 12

  • Max-Flow Min-Cut Theorem

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    6.6: Maximum flow T.S. 13

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 3⇒ 1:

    Suppose that (S,T ) is a cut with c(S,T ) = |f |By Corollary 26.5, for any flow f̃ ,

    |̃f | ≤ c(S,T ) = |f |.

    Hence f is a maximum flow.

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 3⇒ 1:Suppose that (S,T ) is a cut with c(S,T ) = |f |

    By Corollary 26.5, for any flow f̃ ,

    |̃f | ≤ c(S,T ) = |f |.

    Hence f is a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/99/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    10

    2 6

    4

    8

    9

    10

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 3⇒ 1:Suppose that (S,T ) is a cut with c(S,T ) = |f |By Corollary 26.5, for any flow f̃ ,

    |̃f | ≤ c(S,T ) = |f |.Hence f is a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/99/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    10

    2 6

    4

    8

    9

    10

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 3⇒ 1:Suppose that (S,T ) is a cut with c(S,T ) = |f |By Corollary 26.5, for any flow f̃ , |̃f | ≤ c(S,T ) = |f |.

    Hence f is a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/99/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    10

    2 6

    4

    8

    9

    10

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 3⇒ 1:Suppose that (S,T ) is a cut with c(S,T ) = |f |By Corollary 26.5, for any flow f̃ , |̃f | ≤ c(S,T ) = |f |.Hence f is a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/99/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    10

    2 6

    4

    8

    9

    10

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 1⇒ 2:

    For the sake of contradicion, suppose there is an augmenting path withrespect to f .

    Then we can improve f by increasing the flow along this path.

    Hence f cannot be a maximum flow.

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 1⇒ 2:For the sake of contradicion, suppose there is an augmenting path withrespect to f .

    Then we can improve f by increasing the flow along this path.

    Hence f cannot be a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/88/9

    6/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    46

    2 6

    4

    8

    18

    4

    6

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 1⇒ 2:For the sake of contradicion, suppose there is an augmenting path withrespect to f .

    Then we can improve f by increasing the flow along this path.

    Hence f cannot be a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/88/9

    6/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    46

    2 6

    4

    8

    18

    4

    6

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 1⇒ 2:For the sake of contradicion, suppose there is an augmenting path withrespect to f .

    Then we can improve f by increasing the flow along this path.

    Hence f cannot be a maximum flow.

    G

    s

    2

    3

    4

    5 t

    10/10

    6/10

    2/2 6/6

    0/4

    8/88/9

    6/10

    10/10

    Gf

    s

    2

    3

    4

    5 t

    10

    46

    2 6

    4

    8

    18

    4

    6

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:

    Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S

    ⇒ s ∈ S, t 6∈ S.

    (u, v) ∈ E(S,T )

    ⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S

    ⇒ s ∈ S, t 6∈ S.

    (u, v) ∈ E(S,T )

    ⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S

    ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )

    ⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.

    (u, v) ∈ E(S,T )

    ⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )

    ⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10

    ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10

    ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).

    (v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    0/2 6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10 ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10

    ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    G

    s

    2

    3

    4

    5 t

    10/10

    9/10

    6/6

    3/4

    7/8

    9/9

    9/10

    10/10

    ���

    10/10

    9/10

    ��0/21/2

    Gf

    s

    2

    3

    4

    5 t

    10

    19

    2 6

    13

    7

    1

    9

    1

    9

    10

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    |f | =

    ∑(u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v)

    = c(S,T )

    6.6: Maximum flow T.S. 14

  • Key Lemma

    The following three conditions are all equivalent for any flow f :

    1. f is a maximum flow

    2. There is no augmenting path in Gf3. There exists a cut (S,T ) such that c(S,T ) = |f |

    Key Lemma (Theorem 26.6)

    Proof 2⇒ 3:Let f be a flow with no augmenting paths.

    Let S be the nodes reachable from s in Gf , T := V \ S ⇒ s ∈ S, t 6∈ S.(u, v) ∈ E(S,T )⇒ f (u, v) = c(u, v).(v , u) ∈ E(T ,S)⇒ f (v , u) = 0.

    |f | =∑

    (u,v)∈E(S,T )

    f (u, v)−∑

    (v,u)∈E(T ,S)

    f (v , u)

    =∑

    (u,v)∈E(S,T )

    c(u, v) = c(S,T )

    6.6: Maximum flow T.S. 14

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≤”:

    For any flow f and cut (S,T ), |f | ≤ c(S,T ) (Corollary 26.5)⇒

    maxf|f | ≤ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≤”:For any flow f and cut (S,T ), |f | ≤ c(S,T ) (Corollary 26.5)

    ⇒max

    f|f | ≤ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≤”:For any flow f and cut (S,T ), |f | ≤ c(S,T ) (Corollary 26.5)

    ⇒max

    f|f | ≤ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≥”:Let fmax be a maximum flow

    Key Lemma⇒ there is a cut (S,T ) with c(S,T ) = |fmax|.⇒

    maxf|f | = |fmax| = c(S,T ) ≥ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≥”:Let fmax be a maximum flow

    Key Lemma⇒ there is a cut (S,T ) with c(S,T ) = |fmax|.

    ⇒max

    f|f | = |fmax| = c(S,T ) ≥ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    The value of the max-flow is equal to the capacity of the min-cut, that is

    maxf|f | = min

    S,T⊆Vc(S,T ).

    Theorem

    Proof of “≥”:Let fmax be a maximum flow

    Key Lemma⇒ there is a cut (S,T ) with c(S,T ) = |fmax|.⇒

    maxf|f | = |fmax| = c(S,T ) ≥ min

    S,T⊆Vc(S,T )

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:

    Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:Run Ford-Fulkerson until it terminates with a flow fmax

    Define S as the set of nodes reachable from s in Gf , and T = V \ S⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Proof of the Max-Flow Min-Cut Theorem

    The following conditions are equivalent for any flow f :

    1. f is a maximum flow.

    2. There is no augmenting path in Gf .

    3. There exists a cut (S,T ) such that c(S,T ) = |f |.

    Key Lemma

    Max-Flow Min-Cut Theorem algorithm for computing min-cut:Run Ford-Fulkerson until it terminates with a flow fmaxDefine S as the set of nodes reachable from s in Gf , and T = V \ S

    ⇒ (S,T ) is a minimal (s, t)-cut whose capacity is equal to |fmax|

    6.6: Maximum flow T.S. 15

  • Outline

    Recap

    Max-Flow Min-Cut Theorem

    Analysis of Ford-Fulkerson

    6.6: Maximum flow T.S. 16

  • Analysis of Ford-Fulkerson

    0: def FordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    If all capacities c(u, v) are integral, then the flow at every iteration ofFord-Fulkerson is integral.

    Lemma

    Flow before iteration integral& capacities in Gf are integral⇒ Flow after iteration integral

    For integral capacities c(u, v), Ford-Fulkerson terminates after V · Citerations, where C := maxu,v c(u, v) and returns the maximum flow.

    Theorem

    at the time of termination, no augmenting path⇒ Ford-Fulkerson returns maxflow (Key Lemma)

    6.6: Maximum flow T.S. 17

  • Analysis of Ford-Fulkerson

    0: def FordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    If all capacities c(u, v) are integral, then the flow at every iteration ofFord-Fulkerson is integral.

    Lemma

    Flow before iteration integral& capacities in Gf are integral⇒ Flow after iteration integral

    For integral capacities c(u, v), Ford-Fulkerson terminates after V · Citerations, where C := maxu,v c(u, v) and returns the maximum flow.

    Theorem

    at the time of termination, no augmenting path⇒ Ford-Fulkerson returns maxflow (Key Lemma)

    6.6: Maximum flow T.S. 17

  • Analysis of Ford-Fulkerson

    0: def FordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    If all capacities c(u, v) are integral, then the flow at every iteration ofFord-Fulkerson is integral.

    Lemma

    Flow before iteration integral& capacities in Gf are integral⇒ Flow after iteration integral

    For integral capacities c(u, v), Ford-Fulkerson terminates after V · Citerations, where C := maxu,v c(u, v) and returns the maximum flow.

    Theorem

    at the time of termination, no augmenting path⇒ Ford-Fulkerson returns maxflow (Key Lemma)

    6.6: Maximum flow T.S. 17

  • Analysis of Ford-Fulkerson

    0: def FordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    If all capacities c(u, v) are integral, then the flow at every iteration ofFord-Fulkerson is integral.

    Lemma

    Flow before iteration integral& capacities in Gf are integral⇒ Flow after iteration integral

    For integral capacities c(u, v), Ford-Fulkerson terminates after V · Citerations, where C := maxu,v c(u, v) and returns the maximum flow.

    Theorem

    at the time of termination, no augmenting path⇒ Ford-Fulkerson returns maxflow (Key Lemma)

    6.6: Maximum flow T.S. 17

  • Analysis of Ford-Fulkerson

    0: def FordFulkerson(G)1: initialize flow to 0 on all edges2: while an augmenting path in Gf can be found:3: push as much extra flow as possible through it

    If all capacities c(u, v) are integral, then the flow at every iteration ofFord-Fulkerson is integral.

    Lemma

    Flow before iteration integral& capacities in Gf are integral⇒ Flow after iteration integral

    For integral capacities c(u, v), Ford-Fulkerson terminates after V · Citerations, where C := maxu,v c(u, v) and returns the maximum flow.

    Theorem

    at the time of termination, no augmenting path⇒ Ford-Fulkerson returns maxflow (Key Lemma)

    6.6: Maximum flow T.S. 17

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1 s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1 s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000

    1000

    1

    9991

    1000

    1000

    9991

    1

    9991

    9991

    9991

    9991

    1

    9982

    9991

    9991

    9982

    1

    9982

    9982

    9982

    9982

    1

    9973

    9982

    9982

    9973

    1

    9973

    9973

    9973

    9973

    1

    Number of iterations is at least C := maxu,v c(u, v)!

    For irrational capacities, Ford-Fulkersonmay even fail to terminate!

    6.6: Maximum flow T.S. 18

  • Slow Convergence of Ford-Fulkerson (Figure 26.7)

    s

    u

    v

    t

    G

    0/1000

    0/1000

    0/1000

    0/1000

    0/1

    1/1000

    0/1000

    0/1000

    1/1000

    1/1

    1/1000

    1/1000

    1/1000

    1/1000

    0/1

    2/1000

    1/1000

    1/1000

    2/1000

    1/1

    2/1000

    2/1000

    2/1000

    2/1000

    0/1

    3/1000

    2/1000

    2/1000

    3/1000

    1/1

    3/1000

    3/1000

    3/1000

    3/1000

    0/1

    s

    u

    v

    t

    Gf

    1000

    1000

    1000