SlideShare a Scribd company logo
1 of 39
NETWORK FLOWS
BY- RICHA BANDLAS(1913106)
Contents:
1. What is Network Flow?
2. Maximum Flow problem and Ford-Fulkerson Algorithm
3. Max-Flow and Min-cut
4. Choosing Good Augmenting paths
5. Preflow-Push Maximum-flow algorithm
6. Bipartite Matching Problem
Flow
Networks:
A flow network is a connected,
directed graph G = (V, E),which is
simple path.
Each edge e has a non-negative,
integer capacity c(e).
• A single source s ∈ V.
• A single sink t ∈ V.
• No edge enters the source and no
edge leaves the sink.
Flow
capacity
FLOW
Def. An s-t flow is a function f : E → R that assigns a real
number to each edge.
◦ f (e) is the amount of material carried on the edge e.
Constraints on f :
◦ 0 ≤ f (e) ≤ c(e) for each edge e. (capacity constraints)
◦ For each node v except s and t, we have:
𝑒 𝑖𝑛𝑡𝑜 𝑣 𝑓(𝑒) = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒)
(balance constraints: whatever flows in, must flow out).
The value of a flow f , denoted ν(f ), is defined to be the amount of
flow generated at the source:
𝑣 𝑓 = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒)
Maximum Flow Problem
Given a flow network, find a flow of maximum possible value.
Start with Greedy Approach:
1. Suppose we let f (e) = 0 for all edges (no flow anywhere).
2. Choose some s − t path (P) and find its minimum capacity.
3. Push flow on this path. Repeat.
PATH Bottleneck
s->a->t 5
s->b->d->t 8
s->c->t 5
Now we are stuck . So Flow = (5+8+5 = 18) but is this Maximum flow?
Residual Graph: We define a residual graph G` . G` depends on some flow f :
1. G` contains the same nodes as G.
2. Forward edges: For each edge e = (u, v) of G for which f (e) < c(e) , include an edge e = (u, v) in G` with capacity c(e)−
f (e) (Also called Residual capacity).
3. Backward edges: For each edge e = (u, v) in G with f (e) > 0, we include an edge e = (v, u) in G` with capacity f (e).
Residual Graph G` of previous graph is:
Blue edges- Residual capacity
Black edges- Backward edges
showing flow which can be
reverted
Augmenting Path:
1. Let P be an s − t path in the residual graph G`.
2. Let bottleneck(P, f ) be the smallest capacity in G` on any edge of P.
3. If bottleneck(P, f ) > 0 then we can increase the flow by sending bottleneck(P, f ) along the path P
Following function yields a new flow f` in G:.
augment(f, P):
b = bottleneck(P,f)
For each edge (u,v) ∈ P:
If e = (u,v) is a forward edge:
Increase f(e) in G by b //add some flow
Else:
e’ = (v,u)
Decrease f(e’) in G by b //erase some flow
EndIf
EndFor
Return f
After f`= augment(P, f ), we still have a flow:
Consider the path s->a->d->b->c->t in residual graph G`:
Bottleneck = 3
Original Graph
Residual Graph after applying flow
MAX-FLOW = 5+8+5+3= 21
Ford-Fulkerson Algorithm
Max-Flow
Initially f (e) = 0 for all e in G //Initialize
While there is an s-t path in the residual graph Gf
Let P be a simple s-t path in Gf
f` = augment(f , P)
Update f to be f`
Update the residual graph Gf to be Gf`
Endwhile
Return f
Capacity constraints: Let e be an edge on P:
1. if e is forward edge, it has capacity c(e) − f (e). Therefore,
f`(e) = f(e) + bottleneck(P, f ) ≤ f(e) + (c(e) − f (e)) ≤ c(e)
2. if e is a backward edge, it has capacity f (e). Therefore,
c(e)>= f(e) >= f`(e) = f(e) − bottleneck(P, f ) ≥ f(e) − f (e) = 0
TERMINATION CONDITION:
Theorem: The Ford-Fulkerson algorithm terminates in C iterations of the while loop
1. At every step, the flow values f (e) are integers.
2. At every step we increase the amount of flow v(f ) sent by at least 1 unit.
3. We can never send more than C= 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒)
Running Time:
Theorem: The Ford-Fulkerson algorithm can be implemented to run in O(mC) time.
1. If G has m edges, G` has ≤ 2m edges.
2. Can find an s − t path in G` in time O(m + n) time with DFS or BFS.
3. Since m ≥ n/2 (every node is adjacent to some edge),
O(m + n) = O(m). (This is for one iteration)
Flows and Cuts
We will show that the flow that is returned by the
Ford-Fulkerson Algorithm has the maximum
possible value of any flow in G.
Cut: Given a network G, define a cut (also called
an s-t cut) to be a partition of the vertex set into two
disjoint subsets A ⊆ V and B = V  A, where s ∈ A
and t ∈ B.
Capacity: The capacity(A, B) of an s-t cut (A, B) is
the sum of the capacities of edges leaving.
C(A,B) = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝐴 𝑐(𝑒)
Flow: Let f be any s-t flow, and (A, B) any s-t cut.
Then ν(f ) =
THEOREM:
Proof:
This shows that value of every flow is upper-bounded by capacity of every cut.
MAX FLOW /MIN CUT ALGORITHM:
Let f` be the flow returned by our algorithm. Look at G` but define a cut in G.
Let (A`,B`) be the cut in G, where A`=[s,a] and B`= [ b,d,c,t].
1. Edges (u, v) from A` to B` must be saturated — otherwise there would be a forward edge (u, v) in G` and v would
be part of A`.
2. Edges (v, u) from B` to A` must be empty — otherwise there would be a backedge (u, v) in G` and v would be part
of A`.
Fig ref: Jon Kleinberg
Given a flow f of maximum value, we can compute an s-t cut of minimum capacity in O(m) time,
A` B`
5
3
8
5
0
= 21
Good Augmenting Paths
1. Worst case of choosing augmenting path can be if it increases the flow by 1 unit in each
iteration.
2. If we try to augmenting path based on maximum bottleneck value, then it will be time
consuming.
3. Capacity Scaling: Maintain a scaling parameter, ∆ , and look for paths which have
bottleneck capacity of at least ∆.
Conditions on ∆:
o ∆ is power of 2.
o ∆ < = maximum capacity out of s
It works on residual graph and using DFS, selects the path with bottleneck at least ∆. Similar to
Ford-Fulkerson Algorithm.
Example
Step1: Finding maximum capacity:
u = max(10,8,5)
=> u = 10
Step2: choose ∆= power of 2 <= u.
So, ∆ = 8 ≤ 10
Step3: With ∆=8
With ∆= 4
With ∆= 2
Path Bottleneck ∆
S->b->d->t 8 8
S->c->t 5 4
S->a->t 5 4
S->a->d-
>b->c->t
3 2
Final residual graph:
With ∆=1 : There is no path available.
With ∆=0 : There is no path available. So, Algorithm Terminates
Flow = 8+5+5+3 =21
Algorithm:
Algorithm taken from Jon Kleinberg
Given a flow f of um value, we can compute an s-t cut of minimum capacity in O(m) time,
The number of iterations of the outer While loop is at most 1+ log2 C.
The number of augmentations in a scaling phase is at most 2m..
The Scaling Max-Flow Algorithm in a graph with m edges and integer capacities finds a maximum flow in at most
2m(1+ log2 C) augmentations. It can be implemented to run in at most O(m
2
log2 C) time.
Preflow-Push Maximum-Flow Algorithm
o Performs local updates repeatedly until global constraint is satisfied.
o Algorithm is based on two assumptions:
1. Doesn’t obey flow conservation. The flow entering the node is allowed to be more than the flow leaving it.
This is termed as Preflow.
2. “Height” is assigned to each node in the graph called labels(h(v)) and flow is only sent from higher label to
lower label. Increasing height of a node is called “Relabel” operation.
In the beginning
◦ “Source” is the highest point .
◦ “Sink” and all other nodes are at the lowest point.
Constraints:
Now heights and and a preflow is compatible only if:
1. For all edges (v, w) in the residual graph, we have h(v) ≤ h(w) + 1.
2. Edges must respect the capacity condition.
Active node: A node is active if there is some excess flow coming out of it.
Excess Flow:
A preflow where all nodes other than s and t have zero excess is a flow.
Algorithm Steps:
Step1: Initialize source h(s)=n and all other nodes
with h(v)=0 and e(v)=0.
Step2: s sends flow to its neighbors, completely
saturating all its outgoing edges.
Above step make neighbors nodes as active.
Step3: We increase the height of the “active” node
with a “Relabel” operation
If h is the minimum height among neighbors that
can accept flow
Then height is relabeled to (h+1).
Step4: Algorithm terminates when there are no
“active” nodes left.
Step 1:
1. Relabel a with h=1 and push 5
on (a,t)
2. With h=1, push 3 on edge (a,d)
3. Thirdly, Relabel a with h=7,
and
push (-2) on edge (a,s)
Step 2:
• Relabel ‘b’ with h=1 , push 8 on
edge (b,d)
• Relabel ‘c’ with h=1 , push 5 on
edge (c,t)
Step 3:
• Relabel ‘d’ with h=1, push 8 on
edge (d,t)
• Relabel ‘d’ with h=2, push (-3) on
edge (c,b)
Step 4:
relabel ‘b’ with h=2,
push 3 on edge (b,c)
Step 5:
• As ‘c’ has height, h=1, which is
already greater than ‘t’ which has
h=0 , so we can push 3 on edge
(c,t).
As we can see, all the vertices has
excess flow e=0, so the algorithm
terminates here.
Maximum Flow = 21
Running time:
Running time of Preflow-Push Relabel Algorithm is O(V2. E), where V is Vertices and E is edges.
Note: This can be further improved by using advanced techniques.
Maximum Bipartite
Matching
Bipartitie Graph: A bipartite graph (or bigraph) is a graph
whose vertices can be divided into two disjoint and
independent sets U and V such that every edge connects a
vertex in U to one in V.
Suppose we have {a,b,c,d,e} as People and {1,2,3,4,5} as
tasks. Each person can do only some of the jobs.
A matching gives an assignment of people to tasks.
Maximum matching: one that contains as many edges as
possible (we want to get as many tasks done as possible).
We need to find out , Maximum Bipartite Matching in a given
Biparitite Graph.
Use of Network Flow: Transform a Bipartite Graph into Network
flow, Finding the maximum flow , will give maximum bipartite
Matching.
STEPS TO TRANSFORM BIPARTITE GRAPH INTO NETWORK FLOW:
1. Given bipartite graph G = (A ∪ B, E), direct the edges from A to B.
2. Add new vertices s and t.
3. Add an edge from s to every vertex in A.
4. Add an edge from every vertex in B to t.
5. Make all the capacities 1.
6. Solve maximum network flow problem on this new graph G`
Edges used in maximum network flow is the largest possible matching.
People Jobs
Analysis
1. As capacities are integers, flow will be
integral.
2. Each edge has capacity of 1, so it is
either included in flow or not.
Let M be the edges going from people to
tasks.
M is a matching: For M being a matching, no
two edges share an end point.
We can choose at most one edge leaving
any node in People.
We can choose at most one edge entering
any node in Jobs.People Jobs
M is maximum matching
1. If there is a matching of k edges, there is a flow f of value k.
2. We find the maximum flow f.
3. This corresponds to a matching M of k edges.
4. If there were a matching with > k edges, we would have found a flow with value > k,
contradicting that f was maximum.
5. Hence, M is maximum.
Running Time
Running time of ford Fulkerson algorithm is O(mC) where m is the number of edges and C is the
capacity.
Here, C=|People|=|Jobs|= n ,that is, number of nodes
So, Running time of Bipartite matching is O(mn).
References:
1. Algorithm Design by Jon Kleinberg, Eva Tardos (section 7.1 to 7.5)
2. https://www.cs.cmu.edu/~avrim/451f13/lectures/lect1010.pdf
Thank you!!

More Related Content

What's hot

DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxArbabMaalik
 
Depth first search [dfs]
Depth first search [dfs]Depth first search [dfs]
Depth first search [dfs]DEEPIKA T
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAsst.prof M.Gokilavani
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
A Maximum Flow Min cut theorem for Optimizing Network
A Maximum Flow Min cut theorem for Optimizing NetworkA Maximum Flow Min cut theorem for Optimizing Network
A Maximum Flow Min cut theorem for Optimizing NetworkShethwala Ridhvesh
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
Depth first search and breadth first searching
Depth first search and breadth first searchingDepth first search and breadth first searching
Depth first search and breadth first searchingKawsar Hamid Sumon
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmHema Kashyap
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithmA. S. M. Shafi
 
Flow Network Talk
Flow Network TalkFlow Network Talk
Flow Network TalkImane Haf
 

What's hot (20)

DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptx
 
Depth first search [dfs]
Depth first search [dfs]Depth first search [dfs]
Depth first search [dfs]
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
Huffman coding
Huffman coding Huffman coding
Huffman coding
 
Network flows
Network flowsNetwork flows
Network flows
 
Sum of subset problem.pptx
Sum of subset problem.pptxSum of subset problem.pptx
Sum of subset problem.pptx
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptx
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
A Maximum Flow Min cut theorem for Optimizing Network
A Maximum Flow Min cut theorem for Optimizing NetworkA Maximum Flow Min cut theorem for Optimizing Network
A Maximum Flow Min cut theorem for Optimizing Network
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
Depth first search and breadth first searching
Depth first search and breadth first searchingDepth first search and breadth first searching
Depth first search and breadth first searching
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
A Star Search
A Star SearchA Star Search
A Star Search
 
Flow Network Talk
Flow Network TalkFlow Network Talk
Flow Network Talk
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 

Similar to Network flows

On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...
On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...
On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...AIRCC Publishing Corporation
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...AIRCC Publishing Corporation
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ijcsit
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...AIRCC Publishing Corporation
 
aads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdfaads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdfNanaKoori
 
Design and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment HelpDesign and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment HelpProgramming Homework Help
 
23Network FlowsAuthor Arthur M. Hobbs, Department of .docx
23Network FlowsAuthor Arthur M. Hobbs, Department of .docx23Network FlowsAuthor Arthur M. Hobbs, Department of .docx
23Network FlowsAuthor Arthur M. Hobbs, Department of .docxeugeniadean34240
 
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUB
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUBPresentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUB
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUBWorld University of Bangladesh
 
algorithm_7network_flow.pdf
algorithm_7network_flow.pdfalgorithm_7network_flow.pdf
algorithm_7network_flow.pdfHsuChi Chen
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flowSaruarChowdhury
 
Lecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptLecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptWahyuAde4
 

Similar to Network flows (20)

Maximum flow
Maximum flowMaximum flow
Maximum flow
 
maxflow.ppt
maxflow.pptmaxflow.ppt
maxflow.ppt
 
On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...
On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...
On the Implementation of Goldberg's Maximum Flow Algorithm in Extended Mixed ...
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
 
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
ON THE IMPLEMENTATION OF GOLDBERG'S MAXIMUM FLOW ALGORITHM IN EXTENDED MIXED ...
 
Design & Analysis of Algorithms Assignment Help
Design & Analysis of Algorithms Assignment HelpDesign & Analysis of Algorithms Assignment Help
Design & Analysis of Algorithms Assignment Help
 
aads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdfaads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdf
 
Design and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment HelpDesign and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment Help
 
23Network FlowsAuthor Arthur M. Hobbs, Department of .docx
23Network FlowsAuthor Arthur M. Hobbs, Department of .docx23Network FlowsAuthor Arthur M. Hobbs, Department of .docx
23Network FlowsAuthor Arthur M. Hobbs, Department of .docx
 
Computer Network Homework Help
Computer Network Homework HelpComputer Network Homework Help
Computer Network Homework Help
 
Temporal graph
Temporal graphTemporal graph
Temporal graph
 
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUB
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUBPresentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUB
Presentation 3 ce801 by Rabindra Ranjan Saha, PEng, Assoc. Prof. WUB
 
MaximumFlow.ppt
MaximumFlow.pptMaximumFlow.ppt
MaximumFlow.ppt
 
algorithm_7network_flow.pdf
algorithm_7network_flow.pdfalgorithm_7network_flow.pdf
algorithm_7network_flow.pdf
 
Algorithms Design Exam Help
Algorithms Design Exam HelpAlgorithms Design Exam Help
Algorithms Design Exam Help
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flow
 
Algorithms Design Assignment Help
Algorithms Design Assignment HelpAlgorithms Design Assignment Help
Algorithms Design Assignment Help
 
Lecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptLecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.ppt
 
Network flow problems
Network flow problemsNetwork flow problems
Network flow problems
 

Recently uploaded

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Recently uploaded (20)

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

Network flows

  • 1. NETWORK FLOWS BY- RICHA BANDLAS(1913106)
  • 2. Contents: 1. What is Network Flow? 2. Maximum Flow problem and Ford-Fulkerson Algorithm 3. Max-Flow and Min-cut 4. Choosing Good Augmenting paths 5. Preflow-Push Maximum-flow algorithm 6. Bipartite Matching Problem
  • 3. Flow Networks: A flow network is a connected, directed graph G = (V, E),which is simple path. Each edge e has a non-negative, integer capacity c(e). • A single source s ∈ V. • A single sink t ∈ V. • No edge enters the source and no edge leaves the sink. Flow capacity
  • 4. FLOW Def. An s-t flow is a function f : E → R that assigns a real number to each edge. ◦ f (e) is the amount of material carried on the edge e. Constraints on f : ◦ 0 ≤ f (e) ≤ c(e) for each edge e. (capacity constraints) ◦ For each node v except s and t, we have: 𝑒 𝑖𝑛𝑡𝑜 𝑣 𝑓(𝑒) = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒) (balance constraints: whatever flows in, must flow out). The value of a flow f , denoted ν(f ), is defined to be the amount of flow generated at the source: 𝑣 𝑓 = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒)
  • 5. Maximum Flow Problem Given a flow network, find a flow of maximum possible value. Start with Greedy Approach: 1. Suppose we let f (e) = 0 for all edges (no flow anywhere). 2. Choose some s − t path (P) and find its minimum capacity. 3. Push flow on this path. Repeat.
  • 6. PATH Bottleneck s->a->t 5 s->b->d->t 8 s->c->t 5 Now we are stuck . So Flow = (5+8+5 = 18) but is this Maximum flow?
  • 7. Residual Graph: We define a residual graph G` . G` depends on some flow f : 1. G` contains the same nodes as G. 2. Forward edges: For each edge e = (u, v) of G for which f (e) < c(e) , include an edge e = (u, v) in G` with capacity c(e)− f (e) (Also called Residual capacity). 3. Backward edges: For each edge e = (u, v) in G with f (e) > 0, we include an edge e = (v, u) in G` with capacity f (e). Residual Graph G` of previous graph is: Blue edges- Residual capacity Black edges- Backward edges showing flow which can be reverted
  • 8. Augmenting Path: 1. Let P be an s − t path in the residual graph G`. 2. Let bottleneck(P, f ) be the smallest capacity in G` on any edge of P. 3. If bottleneck(P, f ) > 0 then we can increase the flow by sending bottleneck(P, f ) along the path P Following function yields a new flow f` in G:. augment(f, P): b = bottleneck(P,f) For each edge (u,v) ∈ P: If e = (u,v) is a forward edge: Increase f(e) in G by b //add some flow Else: e’ = (v,u) Decrease f(e’) in G by b //erase some flow EndIf EndFor Return f
  • 9. After f`= augment(P, f ), we still have a flow: Consider the path s->a->d->b->c->t in residual graph G`: Bottleneck = 3 Original Graph Residual Graph after applying flow MAX-FLOW = 5+8+5+3= 21
  • 10. Ford-Fulkerson Algorithm Max-Flow Initially f (e) = 0 for all e in G //Initialize While there is an s-t path in the residual graph Gf Let P be a simple s-t path in Gf f` = augment(f , P) Update f to be f` Update the residual graph Gf to be Gf` Endwhile Return f
  • 11. Capacity constraints: Let e be an edge on P: 1. if e is forward edge, it has capacity c(e) − f (e). Therefore, f`(e) = f(e) + bottleneck(P, f ) ≤ f(e) + (c(e) − f (e)) ≤ c(e) 2. if e is a backward edge, it has capacity f (e). Therefore, c(e)>= f(e) >= f`(e) = f(e) − bottleneck(P, f ) ≥ f(e) − f (e) = 0 TERMINATION CONDITION: Theorem: The Ford-Fulkerson algorithm terminates in C iterations of the while loop 1. At every step, the flow values f (e) are integers. 2. At every step we increase the amount of flow v(f ) sent by at least 1 unit. 3. We can never send more than C= 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝑣 𝑓(𝑒)
  • 12. Running Time: Theorem: The Ford-Fulkerson algorithm can be implemented to run in O(mC) time. 1. If G has m edges, G` has ≤ 2m edges. 2. Can find an s − t path in G` in time O(m + n) time with DFS or BFS. 3. Since m ≥ n/2 (every node is adjacent to some edge), O(m + n) = O(m). (This is for one iteration)
  • 13. Flows and Cuts We will show that the flow that is returned by the Ford-Fulkerson Algorithm has the maximum possible value of any flow in G. Cut: Given a network G, define a cut (also called an s-t cut) to be a partition of the vertex set into two disjoint subsets A ⊆ V and B = V A, where s ∈ A and t ∈ B. Capacity: The capacity(A, B) of an s-t cut (A, B) is the sum of the capacities of edges leaving. C(A,B) = 𝑒 𝑙𝑒𝑎𝑣𝑖𝑛𝑔 𝐴 𝑐(𝑒) Flow: Let f be any s-t flow, and (A, B) any s-t cut. Then ν(f ) =
  • 14. THEOREM: Proof: This shows that value of every flow is upper-bounded by capacity of every cut.
  • 15. MAX FLOW /MIN CUT ALGORITHM: Let f` be the flow returned by our algorithm. Look at G` but define a cut in G. Let (A`,B`) be the cut in G, where A`=[s,a] and B`= [ b,d,c,t].
  • 16. 1. Edges (u, v) from A` to B` must be saturated — otherwise there would be a forward edge (u, v) in G` and v would be part of A`. 2. Edges (v, u) from B` to A` must be empty — otherwise there would be a backedge (u, v) in G` and v would be part of A`. Fig ref: Jon Kleinberg Given a flow f of maximum value, we can compute an s-t cut of minimum capacity in O(m) time, A` B` 5 3 8 5 0 = 21
  • 17. Good Augmenting Paths 1. Worst case of choosing augmenting path can be if it increases the flow by 1 unit in each iteration. 2. If we try to augmenting path based on maximum bottleneck value, then it will be time consuming. 3. Capacity Scaling: Maintain a scaling parameter, ∆ , and look for paths which have bottleneck capacity of at least ∆. Conditions on ∆: o ∆ is power of 2. o ∆ < = maximum capacity out of s It works on residual graph and using DFS, selects the path with bottleneck at least ∆. Similar to Ford-Fulkerson Algorithm.
  • 18. Example Step1: Finding maximum capacity: u = max(10,8,5) => u = 10 Step2: choose ∆= power of 2 <= u. So, ∆ = 8 ≤ 10 Step3: With ∆=8
  • 19. With ∆= 4 With ∆= 2 Path Bottleneck ∆ S->b->d->t 8 8 S->c->t 5 4 S->a->t 5 4 S->a->d- >b->c->t 3 2
  • 20. Final residual graph: With ∆=1 : There is no path available. With ∆=0 : There is no path available. So, Algorithm Terminates Flow = 8+5+5+3 =21
  • 22. Given a flow f of um value, we can compute an s-t cut of minimum capacity in O(m) time, The number of iterations of the outer While loop is at most 1+ log2 C. The number of augmentations in a scaling phase is at most 2m.. The Scaling Max-Flow Algorithm in a graph with m edges and integer capacities finds a maximum flow in at most 2m(1+ log2 C) augmentations. It can be implemented to run in at most O(m 2 log2 C) time.
  • 23. Preflow-Push Maximum-Flow Algorithm o Performs local updates repeatedly until global constraint is satisfied. o Algorithm is based on two assumptions: 1. Doesn’t obey flow conservation. The flow entering the node is allowed to be more than the flow leaving it. This is termed as Preflow. 2. “Height” is assigned to each node in the graph called labels(h(v)) and flow is only sent from higher label to lower label. Increasing height of a node is called “Relabel” operation. In the beginning ◦ “Source” is the highest point . ◦ “Sink” and all other nodes are at the lowest point.
  • 24. Constraints: Now heights and and a preflow is compatible only if: 1. For all edges (v, w) in the residual graph, we have h(v) ≤ h(w) + 1. 2. Edges must respect the capacity condition. Active node: A node is active if there is some excess flow coming out of it. Excess Flow: A preflow where all nodes other than s and t have zero excess is a flow.
  • 25. Algorithm Steps: Step1: Initialize source h(s)=n and all other nodes with h(v)=0 and e(v)=0. Step2: s sends flow to its neighbors, completely saturating all its outgoing edges. Above step make neighbors nodes as active. Step3: We increase the height of the “active” node with a “Relabel” operation If h is the minimum height among neighbors that can accept flow Then height is relabeled to (h+1). Step4: Algorithm terminates when there are no “active” nodes left.
  • 26. Step 1: 1. Relabel a with h=1 and push 5 on (a,t) 2. With h=1, push 3 on edge (a,d) 3. Thirdly, Relabel a with h=7, and push (-2) on edge (a,s)
  • 27. Step 2: • Relabel ‘b’ with h=1 , push 8 on edge (b,d) • Relabel ‘c’ with h=1 , push 5 on edge (c,t)
  • 28. Step 3: • Relabel ‘d’ with h=1, push 8 on edge (d,t) • Relabel ‘d’ with h=2, push (-3) on edge (c,b)
  • 29. Step 4: relabel ‘b’ with h=2, push 3 on edge (b,c)
  • 30. Step 5: • As ‘c’ has height, h=1, which is already greater than ‘t’ which has h=0 , so we can push 3 on edge (c,t). As we can see, all the vertices has excess flow e=0, so the algorithm terminates here. Maximum Flow = 21
  • 31. Running time: Running time of Preflow-Push Relabel Algorithm is O(V2. E), where V is Vertices and E is edges. Note: This can be further improved by using advanced techniques.
  • 32. Maximum Bipartite Matching Bipartitie Graph: A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Suppose we have {a,b,c,d,e} as People and {1,2,3,4,5} as tasks. Each person can do only some of the jobs. A matching gives an assignment of people to tasks. Maximum matching: one that contains as many edges as possible (we want to get as many tasks done as possible).
  • 33. We need to find out , Maximum Bipartite Matching in a given Biparitite Graph. Use of Network Flow: Transform a Bipartite Graph into Network flow, Finding the maximum flow , will give maximum bipartite Matching. STEPS TO TRANSFORM BIPARTITE GRAPH INTO NETWORK FLOW: 1. Given bipartite graph G = (A ∪ B, E), direct the edges from A to B. 2. Add new vertices s and t. 3. Add an edge from s to every vertex in A. 4. Add an edge from every vertex in B to t. 5. Make all the capacities 1. 6. Solve maximum network flow problem on this new graph G` Edges used in maximum network flow is the largest possible matching.
  • 35. Analysis 1. As capacities are integers, flow will be integral. 2. Each edge has capacity of 1, so it is either included in flow or not. Let M be the edges going from people to tasks. M is a matching: For M being a matching, no two edges share an end point. We can choose at most one edge leaving any node in People. We can choose at most one edge entering any node in Jobs.People Jobs
  • 36. M is maximum matching 1. If there is a matching of k edges, there is a flow f of value k. 2. We find the maximum flow f. 3. This corresponds to a matching M of k edges. 4. If there were a matching with > k edges, we would have found a flow with value > k, contradicting that f was maximum. 5. Hence, M is maximum.
  • 37. Running Time Running time of ford Fulkerson algorithm is O(mC) where m is the number of edges and C is the capacity. Here, C=|People|=|Jobs|= n ,that is, number of nodes So, Running time of Bipartite matching is O(mn).
  • 38. References: 1. Algorithm Design by Jon Kleinberg, Eva Tardos (section 7.1 to 7.5) 2. https://www.cs.cmu.edu/~avrim/451f13/lectures/lect1010.pdf