Submitted By: Muhammad Ahmad Submit To: Umer SB BSCS: 4 Semester SESSION: 2017-2021 ROLL# 170125
Submitted By: Muhammad Ahmad Submit To: Umer SB BSCS: 4 Semester SESSION: 2017-2021 ROLL# 170125
SUBMITTED BY:
MUHAMMAD AHMAD
SESSION: 2017-2021
ROLL# 170125
ALI FATIMAH COLLEGE PF SCIENCE AND
MANAGEMEN
Muhammad Ahmad Mian
03216687630
Network Flows
Network
A directed graph G = (V, E) such that
• each directed edge e has its nonnegative capacity denoted by ce
• there is a node s (source) with no incoming edges
• there is a node t (target) with no outgoing edges
u,v - internal
Nodes
u
20 10
s 30 t
10 20
v
Flow
S-t flow in G = (V, E) is a function f from E to R+
Residual graph
Assume that we are given a flow f in graph G.
Residual graph Gf
• The same nodes, internal and s,t
New u
flow: 20 10
s 1020 10 t
10 20
New
Network: residual
graph:
u u
20 10 20 10
s 30 t s 10 20 t
10 10 20
20
v v
Muhammad Ahmad Mian
03216687630
Augmenting path & augmentation
Assume that we are given a flow f in graph G, and
the corresponding residual graph Gf
1. Find a new flow in residual graph - through a path
with no repeating nodes, and value equal to the
minimum capacity on the path (augmenting path)
2. Update residual graph along the path
New
u
New residual
Network: u 20 10 u
flow: graph:
20 10 1020 10 t 20 10
s
s 30 t 10 20 s 10 20 t
10 20 v 10 20
10
v v
Flow: u Residual u
20 0 Graph: 20 10
s 20 t s 20 10 t
0 20 10 20
v v
New residual graph:
u u
New
flow: 20 10 20 10
s 10 20 10 t s 10 20 t
10 20 10 20
v v
Muhammad Ahmad Mian
03216687630