Honors Track: Competitive Programming & Problem Solving Push-Relabel Algorithm Claire Claassen.

Slides:



Advertisements
Similar presentations
1 Review of some graph algorithms Graph G(V,E) (Chapter 22) –Directed, undirected –Representation Adjacency-list, adjacency-matrix Breadth-first search.
Advertisements

MAX FLOW APPLICATIONS CS302, Spring 2013 David Kauchak.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
CSE 326: Data Structures Network Flow and APSP Ben Lerner Summer 2007.
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
The Maximum Network Flow Problem. CSE Network Flows.
1 Maximum Flow w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Nick McKeown Spring 2012 Maximum Matching Algorithms EE384x Packet Switch Architectures.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
CSE 589 Part III The computer is useless It can only answer questions. -- Pablo Picasso.
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
Minimum Cost Flow Lecture 5: Jan 25. Problems Recap Bipartite matchings General matchings Maximum flows Stable matchings Shortest paths Minimum spanning.
Flows sourcesink s t Flows sourcesink edge-weights = capacities.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
1 Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while( 9 simple path p from s to t in G f ) f := f + f p output f Runs in time O(|f max | |E|) where f.
Maximum Flow Maximum Flow Problem The Ford-Fulkerson method
Flow Networks Formalization Basic Results Ford-Fulkerson Edmunds-Karp Bipartite Matching Min-cut.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
Maximum Flow Chapter 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Lecture 16 Maximum Matching. Incremental Method Transform from a feasible solution to another feasible solution to increase (or decrease) the value of.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
Maximum Flow Algorithms —— ACM 黄宇翔. 目录 Max-flow min-cut theorem 12 Augmenting path algorithms 3 Push-relabel maximum flow algorithm.
MAX FLOW APPLICATIONS CS302, Spring 2012 David Kauchak.
1 WEEK 11 Graphs III Network Flow Problems A Simple Maximum-Flow Algorithm Izmir University of Economics.
Honors Track: Competitive Programming & Problem Solving Fun with Graphs II Kevin Verbeek.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
& 6.855J & ESD.78J Algorithm Visualization The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem.
The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem Thanks to Jim Orlin & MIT OCW.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Network Flow Analysis of Algorithms.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
Announcements Finish up Network Flow today Then Review for Final on Monday ◦ HW#5 is due on Monday, let me or the TA’s know if you have trouble starting.
Algorithm Design and Analysis (ADA)
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
Maximum Flow and Dynamic Programming Opening Discussion zWho can describe a flow network to me. What are the properties it has and what types.
The Maximum Network Flow Problem
Contest Algorithms January 2016 Describe the maxflow problem, explain the Ford-Fulkerson, Edmonds-Karp algorithms. Look at the mincut problem, bipartite.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
The Maximum Network Flow Problem
BIPARTITE GRAPHS AND ITS APPLICATIONS
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
The Taxi Scheduling Problem
CMSC 341 Lecture 24 Max Flow Prof. Neary
Network Flows and Matching (Supplementary)
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Network Flows and Matching (Supplementary)
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
MAXIMUM flow by Eric Wengert.
Maximum Flow Neil Tang 4/8/2008
Maximum Bipartite Matching
Presentation transcript:

Honors Track: Competitive Programming & Problem Solving Push-Relabel Algorithm Claire Claassen

Graph algorithms Structure  Max-flow problem  Recap augmenting path algorithms  Push relabel algorithm  Pseudocode  Example  Prove  Run-time

Max-flow problem Maximum flow problem Intuition: Given a network of pipes and a source and sink, how much water can be transported from source to sink?

Max-flow problem Bipartite graphs: Model relations between two classes of objects Examples Boys and girls: “boy x likes girl y” A B

Max-flow problem Bipartite graphs: Model relations between two classes of objects Examples Boys and girls: “boy x likes girl y” Players and clubs: “player x wants to play in club y” A B

Max-flow problem Bipartite graphs: Model relations between two classes of objects Examples Boys and girls: “boy x likes girl y” Players and clubs: “player x wants to play in club y” Employees and jobs: “employee x can perform job y” A B

Max-flow problem Maximum flow problem Input: A graph with edge capacities c ij and a source s and sink t Output: The maximum flow f ij satisfying the flow constraints Flow constraints 0 ≤ f ij ≤ c ij “flow is within capacity” Σ k f ki = Σ k f ik for all i ≠ s, t “flow in = flow out” s = 0 t = c 01 c 02 c 12 c 13 c 14 c 24 c 35 c 45 c 43

Augmenting path algorithm Idea: Find path from s to t and increase flow on the entire path s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1

Augmenting path algorithm Idea: Find path from s to t and increase flow on the entire path s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1

Augmenting path algorithm Idea: Find path from s to t and increase flow on the entire path s = 0 t = /3 0/3 2/2 0/2 0/1 2/2 0/3 2/2 0/1

Augmenting path algorithm Idea: Find path from s to t and increase flow on the entire path s = 0 t = /3 0/2 2/2 0/1 2/2 2/3 2/2 0/1

Augmenting path algorithm Idea: Find path from s to t and increase flow on the entire path s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 3/3 2/2 1/1 Finish: no augmenting path left

Max-Flow idea General idea:  The flow is optimal if there’s no path between s and t Graph approach:  DFS ➨ Ford-Fulkerson algorithm with O(E f*) running time  BFS ➨ Edmonds-Karp algorithm with O(V E 2 ) running time Without searching for path  Push-relabel algorithm ➨ O(V 2 E)

Push-relabel approach

Pseudocode Pseudo-code:  h[s] = |V|  For each v V – {s} do h[v] = 0  For each (s,v) E do f(s,v) = c(s,v)  While f is not feasible flow If there’s a vertex v V – {s,t} and a vertex w V with e(v) > 0and h[v] > h[w] and c’(v,w) > 0  Push min(c’(v,w), e(v)) over edge (v,w)  Else h[v] = h[v] +1

Example HeightExcess flow s t s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1

Example s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1 HeightExcess flow s t3 4

Example s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1 HeightExcess flow s t3 4

Example s = 0 t = /3 0/2 2/2 0/1 0/2 0/3 0/2 0/1 HeightExcess flow s t4

Example s = 0 t = /3 0/2 2/2 1/1 0/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 0/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1 2

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 0/3 0/2 0/1 HeightExcess flow s t1 2

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 2/3 0/2 0/1 HeightExcess flow s t1 2 3

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 2/3 0/2 0/1 HeightExcess flow s t1 2 3

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 2/3 2/2 0/1 HeightExcess flow s t1 2 3

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 2/3 2/2 0/1 HeightExcess flow s t1 2 3

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 2/3 2/2 1/1 HeightExcess flow s t1 2 4

Example s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 3/3 2/2 1/1 HeightExcess flow s t

Comparison s = 0 t = /3 2/3 0/2 2/2 1/1 2/2 3/3 2/2 1/1 s = 0 t = /3 2/3 0/2 1/1 2/2 3/3 2/2 1/1

Prove NodeExcess flow s = 0 1 t=3 2 3/3 0/2 0/1

Prove s = 0 t = /3 0/2 0/1 0/2 0/3 0/2 0/1

Prove 0 1 2

Run time

Run time 2

Run time comparison Ford-Fulkinson s = /1000 0/1 0/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 0/1000

Run time comparison Ford-Fulkinson s = /1000 0/1000 1/1 0/1000 1/1000

Run time comparison Ford-Fulkinson s = /1000 0/1000 1/1 0/1000 1/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 1/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 1/1000

Run time comparison Ford-Fulkinson s = /1000 1/1000 1/1 1/1000 2/1000

Run time comparison Ford-Fulkinson s = /1000 1/1000 1/1 1/1000 2/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 2/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 2/1000

Run time comparison Ford-Fulkinson s = /1000 2/1000 1/1 2/1000 3/1000

Run time comparison Ford-Fulkinson s = /1000 2/1000 1/1 2/1000 3/1000

Run time comparison Ford-Fulkinson s = /1000 0/1 3/1000

Run time comparison Ford-Fulkerson Edmonds-Karp s = /1000 0/1 1000/1000 s = /1000 0/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp s = /1000 0/1 1000/1000 s = /1000 0/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp s = /1000 0/1 1000/1000 s = /1000 0/1000 0/1 1000/1000 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp s = /1000 0/1 1000/1000 s = /1000 0/1000 0/1 1000/1000 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 1/1 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 1/1 999/1000 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 1/1 999/1000 0/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 1/1 999/ /1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 999/ /1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 999/ /1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000

Run time comparison Ford-Fulkerson Edmonds-Karp Push-Relabel Algorithm s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000

Run time comparison s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000 s = /1000 0/1 1000/1000