SlideShare a Scribd company logo
1
Review of some graph algorithms
• Graph G(V,E) (Chapter 22)
– Directed, undirected
– Representation
• Adjacency-list, adjacency-matrix
• Breadth-first search (BFS), O(V+E)
• Depth-first search (DFS), O(V+E), recursive
– Topological Sort
– Strong connected components
2
Review of some graph algorithms
• Minimum Spanning Tree (Chapter 23)
– Greedy algorithm
– Kruskal’s algorithm: O(ElgV)
• Using disjoint set algorithm, similar to connected components
– Prim’s algorithm: O(E+VlgV)
• Similar to Dijkstra, using min-priority QUEUE
• Single-source shortest paths (Chapter 24)
– Bellman-Ford algorithm: O(VE)
• dj=min{dj,dk+w(j,k)} where k is j’s neighbor
– Dijkstra’s algorithm: O(E+VlgV)
• Find the closest node n1 which is s’s neighbor, modify other nodes distance
• Find the second closest node n2 which is the neighbor of s or n1, modify the
distance
• Find the third closest node n3, which is the neighbor of s, n1, or n2, ,….
3
Graph algorithms (cont.)
• All-pairs shortest paths (Chapter 25)
– Floyd-Warshall algorithms: O(V3).
– Dynamic programming, similar to Matrix
Chain Multiplications
– dij
(0)=wij
– For k1 to n
• for i1 to n
– for j1 to n
» dij
(k)=min(dij
(k-1),dik
(k-1)+dkj
(k-1))
4
Maximum Flow (chap. 26)
• Max-flow problem:
– A directed graph G=<V,E>, a capacity function on
each edge c(u,v) 0 and a source s and a sink t. A
flow is a function f : VVR that satisfies:
• Capacity constraints: 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}, vV f(u,v)=0, or to say,
total flow out of a vertex other s or t is 0, or to say, how much
comes in, also that much comes out.
– Find a maximum flow from s to t.
– Denote the value of f as |f|=vVf(s,v), i.e., the total
flow out of the source s.
• |f|=uVf(u,t), i.e., the total flow into the sink t.
5
Example of max-flow problem
6
Ford-Fulkerson method
• Contains several algorithms:
– Residue networks
– Augmenting paths
7
Residual Networks
• Given a flow network G=<V,E> and a flow
f,
– the residual network of G induced by f is
Gf=<V,Ef> where Ef={(u,v)VV:
cf(u,v)=c(u,v)-f(u,v), and cf(u,v)>0}
– a network with left capacity >0, also a flow
network.
8
Residual network and augmenting path
9
Residual network and flow theorem
• Lemma 26.2 (page 653):
– Let G=<V,E> be a flow network with source s and sink
t, and let f be a flow,
– Let Gf be the residual network of G induced by f, and
let f' be a flow of Gf.
– Define the flow sum: f+f' as:
– (f+f')(u.v)=f(u.v)+f'(u.v), then
– f+f' is a flow in G with value |f+f'|=|f|+|f'|.
• Proof:
– Capacity constraint, skew symmetry, and flow
conservation and finally |f+f'|=|f|+|f'|.
10
Augmenting paths
• Let G=<V,E> be a flow network with source s and
sink t, and let f be a flow,
• An augmenting path p in G is a simple path from s
to t in Gf, the residual network of G induced by f.
• Each edge (u,v) on an augmenting path admits
some additional positive flow from u to v without
violating the capacity constraint.
• Define residual capacity of p is the maximum
amount we can increase the flow:
– cf(p)=min{cf(u,v): (u,v) is on p.}
11
Augmenting path
• Lemma 26.3 (page 654):
– Let G=<V,E> be a flow network with source s and sink
t, let f be a flow, and let p be an augmenting path in
Gf. Define fp: VVR by:
• fp(u,v)= cf(p) if (u,v) is on p.
• -cf(p) if (v,u) is on p.
• 0 otherwise
– Then fp is a flow in Gf with value |fp|=cf(p) >0.
• Corollary 26.4 (page 654):
– Define f'=f+fp, then f' is a flow in G with value
|f'|=|f|+|fp|>|f|.
12
Basic Ford-Fulkerson algorithm
Running time: if capacities are in irrational numbers, the algorithm may not terminate.
Otherwise, O(|E||f*|) where f* is the maximum flow found by the algorithm: while loop
runs f* times, increasing f* by one each loop, finding an augmenting path using depth-
first search or breadth-first search costs |E|.
13
Execution of Ford-Fulkerson
14
An example of loop |f*| times
Note: if finding an augmenting path uses breadth-first search, i.e., each augmenting
path is a shortest path from s to t in the residue network, while loop runs
at most O(|V||E|) times (in fact, each edge can become critical at most |V|/2-1 times),
so the total cost is O(|V||E|2). Called Edmonds-Karp algorithm.
15
Network flows with multiple sources and sinks
• Some problems can be reduced to maximum
flow problem. Here give two examples.
• Reduce to network flow with single source and
single sink
• Introduce a supersource s which is directly
connected to each of the original sources si with
a capacity c(s,si)=
• Introduce a supersink t which is directly
connected from each of the original sinks ti with
a capacity c(si,s)=
16
Maximum bipartite matching
• Matching in a undirected graph G=(V,E)
– A subset of edges ME, such that for all vertices vV,
at most one edge of M is incident on v.
• Maximum matching M
– For any matching M′, |M|| M′|.
• Bipartite: V=LR where L and R are distinct and
all the edges go between L and R.
• Practical application of bipartite matching:
– Matching a set L of machines with a set R of tasks to
be executed simultaneously.
– The edge means that a machine can execute a task.
17
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
18
Finding a maximum bipartite matching
• Construct a flow network G′=(V′,E′,C) from
G=(V,E) as follows where =LR:
– V′=V{s,t}, introducing a source and a sink
– E′={(s,u): uL}  E {(v,t): vR}
– For each edge, its capacity is unit 1.
• As a result, the maximum flow in G′ is a
maximum matching in G.
19
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

More Related Content

Similar to MaximumFlow.ppt

aads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdfaads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdf
NanaKoori
 
08-network-flow-problems that are usefull in Oops
08-network-flow-problems that are usefull in Oops08-network-flow-problems that are usefull in Oops
08-network-flow-problems that are usefull in Oops
sj7033742
 
Sequential and parallel algorithm to find maximum flow on extended mixed netw...
Sequential and parallel algorithm to find maximum flow on extended mixed netw...Sequential and parallel algorithm to find maximum flow on extended mixed netw...
Sequential and parallel algorithm to find maximum flow on extended mixed netw...
csandit
 
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
cscpconf
 
Network flows
Network flowsNetwork flows
Network flows
Richa Bandlas
 
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithmmaxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
ZainabShahzad9
 
22 - Max Flow Porblem Ford Fulkerson Method.pdf
22 - Max Flow Porblem Ford Fulkerson Method.pdf22 - Max Flow Porblem Ford Fulkerson Method.pdf
22 - Max Flow Porblem Ford Fulkerson Method.pdf
abeedmaleek
 
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
WahyuAde4
 
Lecture13
Lecture13Lecture13
Lecture13
vaishali_singh
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flow
SaruarChowdhury
 
lecture8-final.pdf ( analysis and design of algorithm)
lecture8-final.pdf ( analysis and design of algorithm)lecture8-final.pdf ( analysis and design of algorithm)
lecture8-final.pdf ( analysis and design of algorithm)
ZainabShahzad9
 
Max Flow Problem
Max Flow ProblemMax Flow Problem
Max Flow Problem
Guillaume Guérard
 
Networks and flows2.pptx
Networks and flows2.pptxNetworks and flows2.pptx
Networks and flows2.pptx
IzukuMidoriya32
 
bellman-ford Theorem.ppt
bellman-ford Theorem.pptbellman-ford Theorem.ppt
bellman-ford Theorem.ppt
SaimaShaheen14
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cut
Mayank Garg
 
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
Programming Homework Help
 
L21-MaxFlowPr.ppt
L21-MaxFlowPr.pptL21-MaxFlowPr.ppt
L21-MaxFlowPr.ppt
KrishanPalSingh39
 
Network flows
Network flowsNetwork flows
Network flows
Luckshay Batra
 
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
Harshal Chaudhari
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
MuradAmn
 

Similar to MaximumFlow.ppt (20)

aads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdfaads_assignment1_answer-1.pdf
aads_assignment1_answer-1.pdf
 
08-network-flow-problems that are usefull in Oops
08-network-flow-problems that are usefull in Oops08-network-flow-problems that are usefull in Oops
08-network-flow-problems that are usefull in Oops
 
Sequential and parallel algorithm to find maximum flow on extended mixed netw...
Sequential and parallel algorithm to find maximum flow on extended mixed netw...Sequential and parallel algorithm to find maximum flow on extended mixed netw...
Sequential and parallel algorithm to find maximum flow on extended mixed netw...
 
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
SEQUENTIAL AND PARALLEL ALGORITHM TO FIND MAXIMUM FLOW ON EXTENDED MIXED NETW...
 
Network flows
Network flowsNetwork flows
Network flows
 
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithmmaxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
maxflow.4up.pdf for the Maximam flow to solve using flord fulkerson algorithm
 
22 - Max Flow Porblem Ford Fulkerson Method.pdf
22 - Max Flow Porblem Ford Fulkerson Method.pdf22 - Max Flow Porblem Ford Fulkerson Method.pdf
22 - Max Flow Porblem Ford Fulkerson Method.pdf
 
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
 
Lecture13
Lecture13Lecture13
Lecture13
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flow
 
lecture8-final.pdf ( analysis and design of algorithm)
lecture8-final.pdf ( analysis and design of algorithm)lecture8-final.pdf ( analysis and design of algorithm)
lecture8-final.pdf ( analysis and design of algorithm)
 
Max Flow Problem
Max Flow ProblemMax Flow Problem
Max Flow Problem
 
Networks and flows2.pptx
Networks and flows2.pptxNetworks and flows2.pptx
Networks and flows2.pptx
 
bellman-ford Theorem.ppt
bellman-ford Theorem.pptbellman-ford Theorem.ppt
bellman-ford Theorem.ppt
 
Max flow min cut
Max flow min cutMax flow min cut
Max flow min cut
 
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
 
L21-MaxFlowPr.ppt
L21-MaxFlowPr.pptL21-MaxFlowPr.ppt
L21-MaxFlowPr.ppt
 
Network flows
Network flowsNetwork flows
Network flows
 
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
Markov Chain Monitoring - Application to demand prediction in bike sharing sy...
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 

More from KrishanPalSingh39

Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
KrishanPalSingh39
 
flows.ppt
flows.pptflows.ppt
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
KrishanPalSingh39
 
presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptx
KrishanPalSingh39
 
HardwareIODevice.ppt
HardwareIODevice.pptHardwareIODevice.ppt
HardwareIODevice.ppt
KrishanPalSingh39
 
fdocuments.in_unit-2-foc.ppt
fdocuments.in_unit-2-foc.pptfdocuments.in_unit-2-foc.ppt
fdocuments.in_unit-2-foc.ppt
KrishanPalSingh39
 
wang.ppt
wang.pptwang.ppt

More from KrishanPalSingh39 (7)

Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
 
flows.ppt
flows.pptflows.ppt
flows.ppt
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptx
 
HardwareIODevice.ppt
HardwareIODevice.pptHardwareIODevice.ppt
HardwareIODevice.ppt
 
fdocuments.in_unit-2-foc.ppt
fdocuments.in_unit-2-foc.pptfdocuments.in_unit-2-foc.ppt
fdocuments.in_unit-2-foc.ppt
 
wang.ppt
wang.pptwang.ppt
wang.ppt
 

Recently uploaded

Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
AI for Legal Research with applications, tools
AI for Legal Research with applications, toolsAI for Legal Research with applications, tools
AI for Legal Research with applications, tools
mahaffeycheryld
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
Prakhyath Rai
 
Engineering Standards Wiring methods.pdf
Engineering Standards Wiring methods.pdfEngineering Standards Wiring methods.pdf
Engineering Standards Wiring methods.pdf
edwin408357
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
morris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdfmorris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdf
ycwu0509
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 

Recently uploaded (20)

Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
AI for Legal Research with applications, tools
AI for Legal Research with applications, toolsAI for Legal Research with applications, tools
AI for Legal Research with applications, tools
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
 
Engineering Standards Wiring methods.pdf
Engineering Standards Wiring methods.pdfEngineering Standards Wiring methods.pdf
Engineering Standards Wiring methods.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
morris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdfmorris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdf
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 

MaximumFlow.ppt

  • 1. 1 Review of some graph algorithms • Graph G(V,E) (Chapter 22) – Directed, undirected – Representation • Adjacency-list, adjacency-matrix • Breadth-first search (BFS), O(V+E) • Depth-first search (DFS), O(V+E), recursive – Topological Sort – Strong connected components
  • 2. 2 Review of some graph algorithms • Minimum Spanning Tree (Chapter 23) – Greedy algorithm – Kruskal’s algorithm: O(ElgV) • Using disjoint set algorithm, similar to connected components – Prim’s algorithm: O(E+VlgV) • Similar to Dijkstra, using min-priority QUEUE • Single-source shortest paths (Chapter 24) – Bellman-Ford algorithm: O(VE) • dj=min{dj,dk+w(j,k)} where k is j’s neighbor – Dijkstra’s algorithm: O(E+VlgV) • Find the closest node n1 which is s’s neighbor, modify other nodes distance • Find the second closest node n2 which is the neighbor of s or n1, modify the distance • Find the third closest node n3, which is the neighbor of s, n1, or n2, ,….
  • 3. 3 Graph algorithms (cont.) • All-pairs shortest paths (Chapter 25) – Floyd-Warshall algorithms: O(V3). – Dynamic programming, similar to Matrix Chain Multiplications – dij (0)=wij – For k1 to n • for i1 to n – for j1 to n » dij (k)=min(dij (k-1),dik (k-1)+dkj (k-1))
  • 4. 4 Maximum Flow (chap. 26) • Max-flow problem: – A directed graph G=<V,E>, a capacity function on each edge c(u,v) 0 and a source s and a sink t. A flow is a function f : VVR that satisfies: • Capacity constraints: 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}, vV f(u,v)=0, or to say, total flow out of a vertex other s or t is 0, or to say, how much comes in, also that much comes out. – Find a maximum flow from s to t. – Denote the value of f as |f|=vVf(s,v), i.e., the total flow out of the source s. • |f|=uVf(u,t), i.e., the total flow into the sink t.
  • 6. 6 Ford-Fulkerson method • Contains several algorithms: – Residue networks – Augmenting paths
  • 7. 7 Residual Networks • Given a flow network G=<V,E> and a flow f, – the residual network of G induced by f is Gf=<V,Ef> where Ef={(u,v)VV: cf(u,v)=c(u,v)-f(u,v), and cf(u,v)>0} – a network with left capacity >0, also a flow network.
  • 8. 8 Residual network and augmenting path
  • 9. 9 Residual network and flow theorem • Lemma 26.2 (page 653): – Let G=<V,E> be a flow network with source s and sink t, and let f be a flow, – Let Gf be the residual network of G induced by f, and let f' be a flow of Gf. – Define the flow sum: f+f' as: – (f+f')(u.v)=f(u.v)+f'(u.v), then – f+f' is a flow in G with value |f+f'|=|f|+|f'|. • Proof: – Capacity constraint, skew symmetry, and flow conservation and finally |f+f'|=|f|+|f'|.
  • 10. 10 Augmenting paths • Let G=<V,E> be a flow network with source s and sink t, and let f be a flow, • An augmenting path p in G is a simple path from s to t in Gf, the residual network of G induced by f. • Each edge (u,v) on an augmenting path admits some additional positive flow from u to v without violating the capacity constraint. • Define residual capacity of p is the maximum amount we can increase the flow: – cf(p)=min{cf(u,v): (u,v) is on p.}
  • 11. 11 Augmenting path • Lemma 26.3 (page 654): – Let G=<V,E> be a flow network with source s and sink t, let f be a flow, and let p be an augmenting path in Gf. Define fp: VVR by: • fp(u,v)= cf(p) if (u,v) is on p. • -cf(p) if (v,u) is on p. • 0 otherwise – Then fp is a flow in Gf with value |fp|=cf(p) >0. • Corollary 26.4 (page 654): – Define f'=f+fp, then f' is a flow in G with value |f'|=|f|+|fp|>|f|.
  • 12. 12 Basic Ford-Fulkerson algorithm Running time: if capacities are in irrational numbers, the algorithm may not terminate. Otherwise, O(|E||f*|) where f* is the maximum flow found by the algorithm: while loop runs f* times, increasing f* by one each loop, finding an augmenting path using depth- first search or breadth-first search costs |E|.
  • 14. 14 An example of loop |f*| times Note: if finding an augmenting path uses breadth-first search, i.e., each augmenting path is a shortest path from s to t in the residue network, while loop runs at most O(|V||E|) times (in fact, each edge can become critical at most |V|/2-1 times), so the total cost is O(|V||E|2). Called Edmonds-Karp algorithm.
  • 15. 15 Network flows with multiple sources and sinks • Some problems can be reduced to maximum flow problem. Here give two examples. • Reduce to network flow with single source and single sink • Introduce a supersource s which is directly connected to each of the original sources si with a capacity c(s,si)= • Introduce a supersink t which is directly connected from each of the original sinks ti with a capacity c(si,s)=
  • 16. 16 Maximum bipartite matching • Matching in a undirected graph G=(V,E) – A subset of edges ME, such that for all vertices vV, at most one edge of M is incident on v. • Maximum matching M – For any matching M′, |M|| M′|. • Bipartite: V=LR where L and R are distinct and all the edges go between L and R. • Practical application of bipartite matching: – Matching a set L of machines with a set R of tasks to be executed simultaneously. – The edge means that a machine can execute a task.
  • 17. 17 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 18. 18 Finding a maximum bipartite matching • Construct a flow network G′=(V′,E′,C) from G=(V,E) as follows where =LR: – V′=V{s,t}, introducing a source and a sink – E′={(s,u): uL}  E {(v,t): vR} – For each edge, its capacity is unit 1. • As a result, the maximum flow in G′ is a maximum matching in G.
  • 19. 19 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.