Maximum flow

28
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25

description

sender. Maximum flow. receiver. Capacity constraint. Lecture 6: Jan 25. Network transmission. Given a directed graph G A source node s A sink node t Goal: To send as much information from s to t. Flows. An s-t flow is a function f which satisfies: (capacity constraint) - PowerPoint PPT Presentation

Transcript of Maximum flow

1

Maximum flow

sender

receiver

Capacity constraintLecture 6: Jan 25

2

Network transmission

Given a directed graph G A source node s A sink node t

Goal: To send as much information from s to t

3

Flows

An s-t flow is a function f which satisfies:

(capacity constraint)

(conservation of flows)

An s-t flow is a function f which satisfies:

(capacity constraint)

(conservation of flows (at intermediate vertices)

4

Value of the flow

s t 10

10

9

8

4

10

10 6 2

10

3

9

9 9 10

7

0

G:6

Value = 19

Maximum flow problem: maximize this value

5

Flow decomposition

Any flow can be decomposed into at most m flow paths.

The same idea applies to the Chinese postman problem

6

An upper bound

sender

receiver

7

Cuts

An s-t cut is a set of edges whose removal

disconnect s and t

The capacity of a cut is defined as the sum of the

capacity of the edges in the cut

Minimum s-t cut problem:

minimize this capacity of a s-t cut

8

Flows ≤ cuts

Let C be a cut and S be the connected component of

G-C containing s. Then:

9

Main result

Value of max s-t flow ≤ capacity of min s-t cut

(Ford Fulkerson 1956)

Max flow = Min cut

A polynomial time algorithm

10

Greedy method?

Find an s-t path where every edge has f(e) < c(e)

Add this path to the flow

Repeat until no such path can be found.

Does it work?

11

A counterexample

Hint: Find an augmenting path

12

Residual graph

Key idea: allow flows to push back

c(e) = 10

f(e) = 2

c(e) = 8

c(e) = 2

Advantage of this representation

is not to distinguish send forward

or push back (which are irrelevant)

Can send 8 units forward

or push 2 units back.

13

Finding an augmenting path

Find an s-t path in the residual graph

Add it to the current flow to obtain a larger flow.

Why?

1. Flow conservations

2. More flow going out from s

Key: don’t think about flow paths!

14

Ford-Fulkerson Algorithm

1. Start from an empty flow f

2. While there is an s-t path P in G

update f along P

3. Return f

15

Max-flow min-cut theorem

Consider the set S of all vertices reachable from s

So, s is in S, but t is not in S

No incoming flow coming in S (otherwise push back)

Achieve full capacity from S to T

Min cut!

16

Integrality theorem

If every edge has integer capacity,

then there is a flow of integer value.

17

Complexity

Assume edge capacity between 1 to C

At most nC iterations

Finding an s-t path can be done in O(m) time

Total running time O(nmC)

18

Speeding up

Capacity scaling (find paths with large capacity)

Find a shortest s-t path time

Preflow-push

19

Faster Algorithms

20

Even Faster Algorithms

21

Applications

of the algorithm

of the min-max theorem

of the integrality theorem

22

Multi-source multi-sink

A set of sources S = {s1,…,sk} A set of sinks T = {t1,…,tm} Maximum flow from S to T

23

Bipartite matching

Bipartite matching <= Maximum flow

24

Disjoint paths

Find the maximum number of disjoint s-t paths

directed edge => directed vertex (vertex splitting)

directed vertex => undirected vertex (bidirecting)

undirected vertex => undirected edge (line graph)

25

Minimum Path Cover

Given a directed graph, find a minimum number of paths to cover all vertices

Directed graph => Bipartite graph

26

Matrix Rounding

Round the entries to “keep” the row sums and column sums

27

League winner

See if your favorite team can still win the leaque

28

Bonus Question 3

(25%) In a soccer tournament of n  teams, every pair of teams plays one match.

The winner gets 3 points, the loser gets 0, while both teams receive 1 point in a draw.

Is there a polynomial algorithm to decide whether a given score sequence

(a score for each team) can be the score sequence at the end of a valid championship?

League winner version is NP-hard.