0% found this document useful (0 votes)
43 views35 pages

Maximum Flow Ford-Fulkerson Algorithm

The document discusses the Maximum Flow Problem and the Ford-Fulkerson Algorithm, which aims to maximize flow in a directed graph network from a source to a sink. It explains key concepts such as flow networks, flow values, residual networks, and augmenting paths, which are essential for computing maximum flow. The classic method involves identifying augmenting paths and updating flows until no more augmenting paths exist.

Uploaded by

mudit6565
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views35 pages

Maximum Flow Ford-Fulkerson Algorithm

The document discusses the Maximum Flow Problem and the Ford-Fulkerson Algorithm, which aims to maximize flow in a directed graph network from a source to a sink. It explains key concepts such as flow networks, flow values, residual networks, and augmenting paths, which are essential for computing maximum flow. The classic method involves identifying augmenting paths and updating flows until no more augmenting paths exist.

Uploaded by

mudit6565
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Maximum Flow

Ford-Fulkerson Algorithm
Maximum Flow Problem
 How can we maximize the flow in a network from a source or set of
sources to a destination or set of destinations?

2
Network Flow
• A Network is a directed graph G
• Edges represent pipes that carry flow
• Each edge (u,v) has a maximum capacity c(u,v)
• A source node s in which flow arrives
• A sink node t out which flow leaves

Goal:
Max Flow

3
The Problem
 Use a graph to model material that flows through pipe
 Each edge represents one pipe , and has a capacity, which is
an upper bound on the flow rate, in units/time.
 Can think of edges as pipes of different sizes.
 Want to compute max rate that we can ship material from a
designated source to a designated sink.

4
What is a Flow Network?
 Each edge (u,v) has a nonnegative capacity c(u,v).
 If (u,v) is not in E, assume c(u,v)=0.
 We have a source s, and a sink t.
 Assume that every vertex v in V is on some path from s to t.
 e.g., c(s,v1)=16; c(v1,s)=0; c(v2,v3)=0

5
What is a Flow in a Network?
 For each edge (u,v), the flow f(u,v) is a real-valued
function that must satisfy 3 conditions:
Capacity constraint: u,v V , f (u,v ) c (u,v )

Skew symmetry: u,v V , f (u,v )  f (v,u )

Flow conservation: u V  {s ,t }, f (u,v ) 0


vV

 Notes:
 The skew symmetry condition implies that f(u,u)=0.
 We show only the positive capacity/flows in the flow network.

6
Example of a Flow:
capacity
flo
w
capacity

 f(v2, v1) = 1, c(v2, v1) = 4.


 f(v1, v2) = -1, c(v1, v2) = 10.
 f(v3, s) + f(v3, v1) + f(v3, v2) + f(v3, v4) + f(v3, t) =
0 + (-12) + 4 + (-7) + 15 = 0

7
The Value of a flow
 The value of a flow is given by
| f | f ( s, v)  f (v, t )
vV vV
 This is the total flow leaving s = the total flow arriving in t.

8
Example:

|f| = f(s, v1) + f(s, v2) + f(s, v3) + f(s, v4) + f(s, t) =
11 + 8 + 0 + 0 + 0 = 19

|f|= f(s, t) + f(v1, t) + f(v2, t) + f(v3, t) + f(v4, t) =


0 + 0 + 0 + 15 + 4 = 19

9
A flow in a network
 We assume that there is only flow in one direction at a time.

 Sending 7 trucks from Edmonton to Calgary and 3 trucks from


Calgary to Edmonton has the same net effect as sending 4
trucks from Edmonton to Calgary.

10
Residual Networks

The residual capacity of an edge (u,v) in a network with a flow f is
given by:

c f (u , v) c(u , v)  f (u , v)

• The residual network of a graph G induced by a flow f is the graph


including only the edges with positive residual capacity, i.e.,

Gf (V , Ef ), where Ef {(u,v )  V V : cf (u,v )  0}

11
Example of Residual Network

Flow Network:

Residual
Network:

12
Augmenting Paths
 An augmenting path p is a simple path from s
to t on the residual network.
 We can put more flow from s to t through p.
 We call the maximum capacity by which we
can increase the flow on p the residual
capacity of p.

c f ( p ) min{c f (u , v) : (u , v) is on p}

13
Augmenting Paths

Network:

Residual
Network:

Augmenting
path The residual capacity of this augmenting path is 4.

14
Computing Max Flow
 Classic Method:
 Identify
augmenting path
 Increase flow along that path
 Repeat

15
Ford-Fulkerson Method

16
Working

Initialize the flow with its value set to zero for each edge.
So long as there exists an augmenting path between s and t, add the path to the
flow.
Update the residual graph.
If required, we must also take into consideration the reverse path. Otherwise, we
might never find the maximum flow.

You might also like