Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.

Post on 20-Jan-2018

238 views 2 download

description

Flow Given a flow network G=(V,E) with capacity function c. Let s be the source and t the sink. A flow in G is a real-valued function f: V×V  R satisfying the following three properties: Capacity constraint: For all u,v  V, f(u,v)  c( u,v). Skew symmetry: For all u,v  V, f(u,v) = -f(v, u). Flow conservation: For all u  V-{s,t}, If (u, v)  E, and (v, u)  E, then we must have f (u, v) = f (v, u) = 0. By skew symmetry, for all v  V-{s,t},

transcript

Maximum Flow Problem

Definitions and notationsThe Ford-Fulkerson method

Flow Networks

FlowGiven a flow network G=(V,E) with capacity function c. Let s be the source and t the sink.A flow in G is a real-valued function f: V×V R satisfying the following three properties:

Capacity constraint: For all u,v V, f(u,v) c( u,v). Skew symmetry: For all u,v V, f(u,v) = -f(v, u) . Flow conservation: For all u V-{s,t},

( , ) 0v V

f u v

If (u, v) E, and (v, u) E, then we must have f (u, v) = f (v, u) = 0.

( , ) 0u V

f u v

By skew symmetry, for all

v V-{s,t},

Value of a Flow

The value of a flow is defined as

Vv

vsff ),(

Maximum-flow Problem

Input: a flow network G with source s and sink t.Output: a flow of maximum value

Working with Flows

If X and Y are sets of vertices in a flow network, then

The flow conversation property can be expressed as for all u V-{s,t}

( , ) ( , )x X y Y

f X Y f x y

( , ) 0f u V

Working with Flows

( , ) ( , )f f s V f V t

Maximum-flow Problem

Input: a flow network G with source s and sink tOutput: a flow of maximum value

How to solve it efficiently?

The Ford-Fulkerson Method

Why “method” not “algorithm”?

The Ford-Fulkerson method depends on three important ideas: Residual Network, Augmenting Path, and Cut.

These ideas are essential to the important max-flow min-cut theorem, which characterizes the value of maximum flow in terms of cuts of the flow network.

The Ford-Fulkerson Method

FORD-FULKERSON-METHOD(G, s, t)1. initialize flow f to 02. while there exists an augmenting path p3. do augment flow f along p4. return f

Residual NetworksGiven a flow network and a flow, the residual network consists of edges that can admit more flow. More formally, given:

G=(V, E): a flow network with source s and sink t f: a flow in G. the residual capacity of (u,v), given by: cf (u,v) = c(u,v) - f(u,v)

Residual network: Gf = (V, Ef ), where

Ef ={(u,v) V×V: cf (u,v) > 0}

Residual Networks (example)

The relationship between a flow in a residual network and one in the original network

*

Augmenting pathsGiven a flow network G=(V, E) and a flow f, an augmenting path is a simple path from s to t in the residual network Gf.

Residual capacity of p : the maximum amount by which we can increase the flow along the edges of an augmenting path p, i.e.,

cf (p) = min { cf (u,v): (u,v) is on p}.

2 3 1

The residual capacity is 1.

Augmenting Path (example)

Augmenting Path

CutCut (S, T): S is a subset of V, T =V-S, sS and tT.Net flow across the cut (S,T): f(S,T)Capacity of the cut (S,T): c(S,T)Minimum cut of a network:

Cut

Cut

Cut

The Basic Ford-Fulkerson Algorithm

The Basic Ford-Fulkerson Algorithm

Analysis of the algorithm

The running time of the algorithm depends on how the augmenting path is determined. If it is chosen poorly, the algorithm even dose not terminate.If the capacities are integers, the time complexity is O(E f*), where f* is the value of a maximum flow. If we use breadth-first search to find the augmenting path, we can improve the time complexity to O(VE2) (Edmonds-Karp algorithm)

The Edmonds-Karp algorithm

Lemma 26.8 If the Edmonds-Karp algorithm is run on a flow network G = (V, E) with source s and sink t, then fro all vertices vV-{s,t}, the shortest-path distance f(s, v) in the residual network Gf increases monotonically with each flow augmentation.

Edmonds-Karp algorithm

Theorem 26.9 If the Edmonds-Karp algorithm is run on a flow network G = (V, E) with source s and sink t, then the total number of flow augmentations performed by the algorithm is O(VE).

An example

1000

1000

1000

1000

1

s

t

b