cs3000 algorithms data jonathan ullman
play

CS3000: Algorithms & Data Jonathan Ullman Lecture 16: - PowerPoint PPT Presentation

Hello CS3000: Algorithms & Data Jonathan Ullman Lecture 16: Applications of Network Flow March 23, 2020 Midterm II Logistics: Wednesday April 1 st Administratered through Gradescope Exam will be available from 2:50pm


  1. Hello CS3000: Algorithms & Data Jonathan Ullman Lecture 16: Applications of Network Flow • March 23, 2020

  2. Midterm II • Logistics: • Wednesday April 1 st • Administratered through Gradescope • Exam will be available from 2:50pm until _____ • You have 90 minutes from the time you start • Academic Honesty: • You will have to take an honor pledge • Do not discuss the exam with anyone for 24 hours • Please be a good citizen

  3. Midterm II • Format: • Same as Midterm I, but condensed for Gradescope Minimum • Topics (graph algos): • Key graph definitions and concepts spanning µ Tree • Adjacency list / matrix representations • DFS + topological sort • Shortest paths: BFS, Dijkstra, Bellman-Ford • Network flow: concepts, Ford-Fulkerson, choosing paths • Does not include this week

  4. Applications of Network Flow

  5. Applications of Network Flow • Algorithms for maximum flow can be used to solve: • Bipartite Matching 2 • Disjoint Paths me • Survey Design • Matrix Rounding If can be problem a • Auction Design in polynomial time solved • Fair Division • Project Selection can be written as then it • Baseball Elimination application of max flow an • Airline Scheduling • …

  6. Reduction • Definition: a reduction is an efficient algorithm that solves problem A using calls to function that solves problem B.

  7. Mechanics of Reductions • What exactly is a problem ? a list of AGI numbers ACD • A set of legal inputs ! e.g • A set "($) of legal outputs for each $ ∈ ! A in soiled order e g • Example: integer maximum flow V E Ede 3 t where G s Inputs integer for every e C E is an e c f e 3 far flow G A Outputs maximum is an integer fer every et E f where e

  8. Use an alg for Problem A Mechanics of Reductions solve Problem B to Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A we only make Simplified Version solve A call to one

  9. When is a Reduction Correct? Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A Assume for valid For every valid input u for ProbA input Ala If valid output in is any solve A returns w in BH valid output VEA valid orbit u then y a is a T c Alu can be any

  10. What is the Running Time? Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A t Total Time Solve A the running t.me of depends on the input u on differ from that of x size of u may The

  11. Max flow A Example: Minimum Cut B at min Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A Ecce 3 x for G B E t V Inpol s 14 t Edel s G V E u for A Input H G max flow f u C Alu A m Outpol

  12. Max flow A Example: Minimum Cut B at min Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A Hr compte residual graph Of f Output ytB x Take in Gf Fund nodes reachable from s those nodes as the art Off

  13. Max flow A Example: Minimum Cut B at min Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A sff.IE Running time j.sndeocna Donothng 0Cn a edges in g 0 nodes in a 3OBFS.OFt.me

  14. A sorting Example: Median median B Input x for Input u for Problem B Problem A SolveA Output y in B(x) Output v in A(u) for Problem B for Problem A An array A of length Input x for B n same array u for A The Input i S

  15. Bipartite Matching DEE He u UEL Ef vice or versa • Input: bipartite graph ' = (*, ,) with * = - ∪ / • Output: a maximum cardinality matching • A matching 0 ⊆ , is a set of edges such that every node 2 is an endpoint of at most one edge in 0 • Cardinality = 0 R L Models any problem where one type of object is assigned to another type: • doctors to hospitals • jobs to processors • advertisements to websites red edges are a matching

  16. ng MBM max bipartite matching Bipartite Matching max flow IMF integer forMBMJ stole Tgif hmg • There is a reduction that uses integer maximum s-t flow to solve maximum bipartite matching.

  17. Step 1: Transform the Input Input G for Input G’ for MCBM MAXFLOW t e t.se t.II.IE

  18. Step 1: Transform the Input Input G for Input G’ for MCBM MAXFLOW

  19. Step 2: Receive the Output Matching will be all of the L Input G’ for R edges MAXFLOW that carry flow SolveA I Output f for MAXFLOW Ts I Red arrow means f(e)=1 Black means f(e) = 0

  20. Step 3: Transform the Output Output M for Output f for MCBM MAXFLOW all edges from L to R M carry flow t

  21. Reduction Recap • Step 1: Transform the Input • Given G = (L,R,E), produce G’ = (V,E,{c(e)},s,t) by... • ... orienting edges e from L to R • ... adding a node s with edges from s to every node in L • ... adding a node t with edges from every not in R to t • ... seting all capacities to 1 • Step 2: Receive the Output • Find an integer maximum s-t flow f in G’ • Step 3: Transform the Output • Given an integer s-t flow f(e)… • Let M be the set of edges e going from L to R that have f(e)=1

  22. Correctness • Need to show: • (1) This algorithm returns a matching • (2) This matching is a maximum cardinality matching the endpoint of is node v Every Matching M 1 in most edge at Its 011 Exactly one edge out of can carry flow u

  23. Correctness • Need to show: • (1) This algorithm returns a matching • (2) This matching is a maximum cardinality matching

  24. Correctness • This algorithm returns a matching

  25. Correctness • Claim: G has a matching of cardinality at least k if and only if G’ has an s-t flow of value at least k A matching of size kuaffineska flow of a E

  26. Correctness • Claim: G has a matching of cardinality at least k if and only if G’ has an s-t flow of value at least k A flow of value k must edges carrying flow k have R from L to R L x is 7 matching of size k floor k

  27. G has m edges nodes Running Time n • Need to analyze the time for: • (1) Producing G’ given G • (2) Finding a maximum flow in G’ • (3) Producing M given G’ edges 2 nodes has ntm G nt OCn in t.ve G Can write 0µF m is the 1 m n where n 12 ntm 1 flow a graph c th n in solve mat to time nm edges nodes m which have flow Scan the edges of G and see t.me 0 ntm

  28. Summary integer Solving maximum s-t flow in a graph with n+2 nodes and m+n edges and c(e) = 1 in time T Solving maximum bipartite matching in a graph with n nodes and m edges in time T + O(m+n) • Can solve max bipartite matching in time O(nm) using Ford-Fulkerson • Improvement for maximum flow gives improvement for maximum bipartite matching

  29. Hallis heoremo gewrymdeojf.IE'd G has a perfect matching o 0 iff does not 0 exist there a SEL of nodes set 0 EIS INDI that 8 such is the 0 PCs 00 set of all neighbors 80 in S of nodes

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend