Algorithm Design and Analysis

Similar documents
Algorithm Design and Analysis

7.5 Bipartite Matching

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Agenda. Soviet Rail Network, We ve done Greedy Method Divide and Conquer Dynamic Programming

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Algorithms and Theory of Computation. Lecture 11: Network Flow

Algorithm Design and Analysis

Soviet Rail Network, 1955

Algorithm Design and Analysis

Algorithm Design and Analysis

Two Applications of Maximum Flow

Algorithms: Lecture 12. Chalmers University of Technology

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

Maximum flow problem

Running Time. Assumption. All capacities are integers between 1 and C.

1 Matchings in Non-Bipartite Graphs

7. NETWORK FLOW II. bipartite matching disjoint paths extensions to max flow 3D Memory Reliability survey design airline scheduling image segmentation

Algorithm Design and Analysis

CSC 373: Algorithm Design and Analysis Lecture 12

Maximum Flow. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Maximum Flow 1 / 27

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Mathematics for Decision Making: An Introduction. Lecture 13

GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017)

6.046 Recitation 11 Handout

Algorithm Design and Analysis

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

10 Max-Flow Min-Cut Flows and Capacitated Graphs 10 MAX-FLOW MIN-CUT

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

Flow Network. The following figure shows an example of a flow network:

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

1 Review for Lecture 2 MaxFlow

RECAP How to find a maximum matching?

Max Flow: Algorithms and Applications

Algorithms: COMP3121/3821/9101/9801

Bipartite Matchings and Stable Marriage

M-saturated M={ } M-unsaturated. Perfect Matching. Matchings

Graph Theory and Optimization Computational Complexity (in brief)

Network Flows. CTU FEE Department of control engineering. March 28, 2017

Parallel Graph Algorithms (con4nued)

CMPSCI 611: Advanced Algorithms

Types of Networks. Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas

Algorithm Design and Analysis

Breadth-First Search of Graphs

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek

The max flow problem. Ford-Fulkerson method. A cut. Lemma Corollary Max Flow Min Cut Theorem. Max Flow Min Cut Theorem

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time

Algorithms. Algorithms 6.4 MAXIMUM FLOW

. CS711008Z Algorithm Design and Analysis. Lecture 10. Algorithm design technique: Network flow and its applications 1. Dongbo Bu

Algorithm Design and Analysis

2.13 Maximum flow with a strictly positive initial feasible flow

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Maximum flow problem (part I)

CMPSCI611: The Matroid Theorem Lecture 5

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 17: Combinatorial Problems as Linear Programs III. Instructor: Shaddin Dughmi

Maximum skew-symmetric flows and matchings

CS 580: Algorithm Design and Analysis

1 Reductions from Maximum Matchings to Perfect Matchings

5 Flows and cuts in digraphs

Algorithms. Algorithms 6.4 MAXIMUM FLOW

We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if

Computing Maximum Flow with Augmenting Electrical Flows

Chapter 7 Matchings and r-factors

Parallel Graph Algorithms (con4nued)

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

Lecture 5 January 16, 2013

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Algorithm Design and Analysis

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

Matching. Slides designed by Kevin Wayne.

Network Flows made simple

Algorithm Design and Analysis

Algorithm Design and Analysis

The min cost flow problem Course notes for Optimization Spring 2007

6. Linear Programming

The min cost flow problem Course notes for Search and Optimization Spring 2004

CS 138b Computer Algorithm Homework #14. Ling Li, February 23, Construct the level graph

Algorithms 6.4 MAXIMUM FLOW. overview Ford-Fulkerson algorithm analysis Java implementation applications

CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

CSC2420: Algorithm Design, Analysis and Theory Fall 2017

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2019

Graph Algorithms -2: Flow Networks. N. H. N. D. de Silva Dept. of Computer Science & Eng University of Moratuwa

C&O 355 Mathematical Programming Fall 2010 Lecture 18. N. Harvey

Ma/CS 6b Class 3: Stable Matchings

Combinatorial Optimization

Algorithm Design and Analysis

CSE 202 Homework 4 Matthias Springer, A

Lecture 8 Network Optimization Algorithms

New Exact and Approximation Algorithms for the Star Packing Problem in Undirected Graphs

The Maximum Flow Problem

Ma/CS 6b Class 25: Error Correcting Codes 2

Ma/CS 6a Class 28: Latin Squares

8.5 Sequencing Problems

- Well-characterized problems, min-max relations, approximate certificates. - LP problems in the standard form, primal and dual linear programs

Recall: Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching

Design and Analysis of Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms

4/30/14. Chapter Sequencing Problems. NP and Computational Intractability. Hamiltonian Cycle

Transcription:

Algorithm Design and Analysis LECTURE 7 Network Flow Application: Bipartite Matching Adam Smith 0//008 A. Smith; based on slides by S. Raskhodnikova and K. Wayne

Recently: Ford-Fulkerson Find max s-t flow & min s-t cut in O(mnC) time All capacities are integers C (We will discuss how to remove this assumption) Duality: Max flow value = min cut capacity Integrality: if capacities are integers, then FF algorithm produces an integral max flow 0//008 A. Smith; based on slides by S. Raskhodnikova and K. Wayne

Last time Reductions Project Selection Problem (Section 7.) Reduction of project selection to min-cut Today: Maximum bipartite matching Reducing MBM to max-flow Hall s theorem 0//008 A. Smith; based on slides by S. Raskhodnikova and K. Wayne

Matching Matching. Input: undirected graph G = (V, E). M E is a matching if each node appears in at most edge in M. Max matching: find a max cardinality matching.

Bipartite Matching Bipartite matching. Input: undirected, bipartite graph G = (L R, E). M E is a matching if each node appears in at most edge in M. Max matching: find a max cardinality matching. ' matching -, -', -' ' L ' R

Bipartite Matching Bipartite matching. Input: undirected, bipartite graph G = (L R, E). M E is a matching if each node appears in at most edge in M. Max matching: find a max cardinality matching. ' max matching -', -, - -' ' L ' R

Reductions Roughly: Problem A reduces to problem B if there is a simple algorithm for A that uses an algorithm for problem B as a subroutine. Usually: Given instance x of problem A we find a instance x of problem B Solve x Use the solution to build a solution to x Useful skill: quickly identifying problems where existing solutions may be applied. Good programmers do this all the time

Reducing Bipartite Matching to Maximum Flow Reduction to Max flow. Create digraph G' = (L R {s, t}, E' ). Direct all edges from L to R, and assign capacity. Add source s, and capacity edges from s to each node in L. Add sink t, and capacity edges from each node in R to t. G' ' s t ' L ' R

Bipartite Matching: Proof of Correctness Theorem. Max cardinality matching in G = value of max flow in G. Proof: We need two statements max. matching in G max flow in G max. matching in G max flow in G

Bipartite Matching: Proof of Correctness Theorem. Max cardinality matching in G = value of max flow in G'. Pf. Given max matching M of cardinality k. Consider flow f that sends unit along each of k paths. f is a flow, and has cardinality k. ' ' s t ' ' G ' ' G'

Bipartite Matching: Proof of Correctness Theorem. Max cardinality matching in G = value of max flow in G'. Pf. Let f be a max flow in G' of value k. Integrality theorem k is integral; all capacities are f is 0-. Consider M = set of edges from L to R with f(e) =. each node in L and R participates in at most one edge in M M = k: consider cut (L s, R t) ' ' s t ' ' G' ' ' G

Exercises Give an example where the greedy algorithm for MBM fails. How bad can the greedy algorithm be, i.e. how far can the size of the maximum matching (global max) be from the size of the greedy matching (local max)? What do augmenting paths look like in this max-flow instance?

Perfect Matching Def. A matching M E is perfect if each node appears in exactly one edge in M. Q. When does a bipartite graph have a perfect matching? Structure of bipartite graphs with perfect matchings. Clearly we must have L = R. What other conditions are necessary? What conditions are sufficient?

Perfect Matching Notation. Let S be a subset of nodes, and let N(S) be the set of nodes adjacent to nodes in S. Observation. If a bipartite graph G = (L R, E), has a perfect matching, then N(S) S for all subsets S L. Pf. Each node in S has to be matched to a different node in N(S). ' No perfect matching: S = {,, } N(S) = {, ' }. ' L ' R

Marriage Theorem Marriage Theorem. [Frobenius 97, Hall 9] Let G = (L R, E) be a bipartite graph with L = R. Then, G has a perfect matching iff N(S) S for all subsets S L. Pf. This was the previous observation. ' No perfect matching: S = {,, } N(S) = {, ' }. ' L ' R

Proof of Marriage Theorem Pf. Suppose G does not have a perfect matching. Formulate as a max flow problem with constraints on edges from L to R and let (A, B) be min cut in G'. By max-flow min-cut, cap(a, B) < L. Choose S = L A. cap(a, B) = L B + R A. Since min cut can't use edges: N(S) R A. N(S ) R A = cap(a, B) - L B < L - L B = S. s G' A ' S = {,, } L B = {, } ' t R A = {, '} N(S) = {, '} '

Bipartite Matching: Running Time Which max flow algorithm to use for bipartite matching? Generic augmenting path: O(m val(f*) ) = O(mn). Capacity scaling: O(m log C ) = O(m ). Shortest augmenting path (not covered in class): O(m n / ). Non-bipartite matching. Structure of non-bipartite graphs is more complicated, but well-understood. [Tutte-Berge, Edmonds-Galai] Blossom algorithm: O(n ). [Edmonds 96] Best known: O(m n / ). [Micali-Vazirani 980] Recently: better algorithms for dense graphs, e.g. O(n.8 ) [Harvey]