1 The Arthur-Merlin Story

Size: px
Start display at page:

Download "1 The Arthur-Merlin Story"

Transcription

1 Comp 260: Advanced Algorithms Tufts University, Spring 2011 Prof. Lenore Cowen Scribe: Andrew Winslow Lecture 1: Perfect and Stable Marriages 1 The Arthur-Merlin Story In the land ruled by the legendary King Arthur, there existed one hundred knights and one hundred ladies. King Arthur proclaimed that all knights and ladies should get married. He soon asked each of the ladies to write down a list of which of the knights they would be willing to wed, and then hand him their preferences. King Arthur took all of the ladies preferences and went back to his castle. He called for his magician, the legendary Merlin, who had access to all the elves, faries, and other mystical creatures. Arthur ordered Merlin to find an marriage so that there would be a perfect matching of the one hundred knights to the one hundred ladies so that each lady is matched to a knight she finds acceptable. Definition A bipartite graph is a graph consisting of two disjoint sets of nodes X and Y, and a set of edges connecting pairs of nodes (a, b), with a X and b Y. Definition A perfect matching (or perfect marriage) on a bipartite graph G = (X, Y, E) is a subset S E of the edges such that if (a, b) S then (a, c) S for any b c and (c, b) S for any c a. Soon enough, by way of magic, Merlin obtained a solution and handed the marriage list to Arthur. Arthur, suspicious of Merlin s abilities, wanted to check that the claimed solution from Merlin was valid. To do so, he used the following algorithm: ArthursAlgorithm(): For each lady: Check that she is only matched to one knight. Check that the knight she is matched to is on her list. 1

2 Such an algorithm takes time polynomial in the number of knights and ladies. Definition An algorithm is polynomial-time if its running time for an input of length n is O(n c ) for some constant c. Now suppose that Merlin was not so lucky. When handed the ladies preference lists, he was not able to find a perfect matching despite utilizing the powers of fairies, elves, creatures, and the clouds. Returning to Arthur, Merlin explained his situation, but Arthur was unbelieving: Merlin, you must find a way to match these knights and ladies. If you cannot find a matching, then you shall lose your head. 1.1 The Decision Problem The decision question solved by Merlin in the story is: Given a bipartite graph with n knights and n ladies does there exist a perfect marriage? We can use ArthursAlgorithm() to verify a proposed solution. Definition NP is the set of problems for which Merlin can present a proof to Arthur that the solution is yes, such that Arthur can verify the proof in polynomial-time. For some problems, Arthur does not need Merlin: he can solve the problem himself in polynomial-time. Definition P is the set of problems Arthur can solve in polynomialtime (i.e. can do without Merlin). Arthur, who is hesitant to pay a wizard s salary and subsidize the fairies, elves, creatures, and other expenses, asks what sort of problems he can pass off to Merlin to solve and which he can still verify the solutions to in polynomial-time. In particular, what are the hardest problems he can give to Merlin to solve and still verify the solutions to. Definition A problem X is NP-Hard if X P P = NP. 2

3 Definition A problem X is NP-Complete if X NP and X is NP-Hard. The NP-Complete problems are the hardest problems Arthur can conquer in this way: any problem solvable in this way can be converted to any instance of an NP-Complete problem and solved in that way. Arthur also wonders about his capability to solve problems currently passed off to Merlin: is the set of problems he can verify and the set of problems he can solve different? State formally, is it true that P NP? Though we suspect so, no known proof exists. 1.2 Saving Merlin s Head Merlin s head will be saved if he can give Arthur a proof that no perfect marriage exists. Definition Co-NP is the set of problems for which Merlin can present a proof to Arthur that the solution is no, such that Arthur can verify the proof in polynomial-time. Now we show that such a proof is possible by presenting a characterization of when perfect marriages are possible. This characterization, called Hall s Theorem, allows the construction of proofs that Arthur can verify. Definition For any set S of vertices in G, the neighbor set of G is all vertices adjacent to vertices in S, written N G (S). Definition A vertex is called saturated if it is matched and unsaturated otherwise. Theorem (Hall s Theorem). Let G be a bipartite graph with bipartition (X, Y ). Then G contains a matching that saturates all the vertices of X if and only if N G (S) S for all S X. Proof. One direction is obvious. Clearly if there is a set of k knights who only like k-1 ladies between them, there can be no marriage. For the other direction, we must show that if G contains no perfect matching then there must exist a set S such that S N G (S). We prove this now by contradiction. 3

4 Suppose G is a bipartite graph such that N G (S) S for all S, but G contains no matching saturating all the vertices in X. Let M be a maximumsized matching in G, and let u X be unmatched in M. Definition An alternating path is a path of edges such that exactly every other edge is contained in M. Definition An augmenting path is an alternating path in which the first and last edges are unmatched. The matching size can be increased by one by swapping all the edges of an augmenting path from matched to unmatched an vice versa. Let S X be the set of all vertices reached by alternating paths from u. Let T = N G (S). Claim M matches T perfectly with S \ {u}. The alternating paths reach Y along edges not in M and reach u along the edges in M. In other words, every vertex of S \ {u} is reached along an edge in M from a vertex in T, so S \ {u} is all matched. But T is matched too, because if there was an unsaturated vertex in T, we would have an alternating path from u to it, contradicting the maximality. Now we use Hall s Theorem to construct an algorithm for find a perfect matching. Theorem There exists a polynomial time algorithm to find a perfect matching. Proof. By construction. We present an algorithm in this section which is based on the proof of Hall s Theorem. The Augmenting Path Algorithm Input: A bipartite graph G = (X, Y, E) with a partition of X (knights) and Y (ladies), and a matching M with k edges in G. Output: A matching M with at least one more edge than M or a proof that G violates Hall s condition [2]. The Algorithm: Let u U be any unmatched vertex in X. Grow a BFS tree from u U. 4

5 Consider only unmatched edges from X to Y and only matched edges from Y to X. If an augmenting path is found, create a new matching M by swapping the matched/unmatched edges along this path and output M. If no augmenting path is found, then output S, N G (S). Since no augmenting path is found, T = S \ {u} and thus N G (S) < S. Time complexity: In each step we add one more edge. We need n edges for the final matching and therefore there are n steps. In each step a BFS tree is created. Each vertex and edge is visited once. Therefore the total time complexity is O(n(n + n 2 )) = O(n 3 ). 2 Stable Marriage Now we consider the problem of stable marriage. Like perfect marriage, stable marriage is concerned with pairing nodes of two disjoint sets. Unlike perfect marriage, stable marriage does not have lists of acceptable pairs, but instead an lists of pairs ordered by preference. Thus stable marriage is concerned with the relative preferences of pairings, rather than whether they are valid or not. Definition A marriage (matching) is stable if and only if there is no man x and woman a such that x prefers a to his current partner and a prefers x to her current partner. This problem occurs in assigning medical school residents to hospitals. Each resident ranks the hospitals and each hospital ranks the residents. The goal is to match residents to hospitals without creating a situation where a resident and a hospital both prefer each other to their current matches. Example: A set of 4 men {x, y, z, w} and 4 women {a, b, c, d}. Each ranked the other group according to liking. Men: x : a > b > c > d y : a > c > b > d z : c > d > a > b w : c > b > a > d Women: a : z > x > y > w b : y > w > x > z c : w > x > y > z d : x > y > z > w 5

6 Any matching where x b and w a is unstable because x prefers a over b and a prefers x over w: An example of a stable matching: x a y b z d w c Theorem For every set of preference rankings among all vertices in a complete bipartite graph, there is always a stable matching. Proof. The proof is by construction. We now provide an algorithm that finds a perfect matching given any set of preference lists. The Gale-Shapley Proposal Algorithm (1962) [1] Input: Preference ranking by each of the n women and n men. Iteration: In round i, each man proposes to the highest woman on his list who has not previously rejected him. If every woman receives exactly one proposal, stop and output the matching. Otherwise, every woman says maybe to the man she received a proposal from who is highest on her list. Termination Does this ever end? Yes, because at every round someone gets rejected. So there are at most n 2 rounds. Correctness We need to show (without loss of generality) that the final output cannot be such that x is matched to b and y is matched to a while x prefers a to b and a prefers x to y. Claim x never proposed to a. Proof. If such a proposal had occurred, x would have received a maybe from a and y never would have. So y couldn t be matched to a. 6

7 Claim It cannot be that x is matched to b and y is matched to a such that x prefers a and a prefers x. Proof. x proposed to b and not a (by previous claim), so x prefers b to a. Stable marriages are not necessarily unique. If we run the above algorithm with men and women swapped (i.e. the women do the proposing) a different stable marriage results: x d y b z a w c References [1] D. Gale and L. Shapley College admissions and the stability of marriage American Mathematical Monthly, Vol 69(9-15), [2] P. Hall, On representations of distinct subsets Journal of the London Math. Society, Vol 10(26-30),

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path.

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path. 3 Matchings Hall s Theorem Matching: A matching in G is a subset M E(G) so that no edge in M is a loop, and no two edges in M are incident with a common vertex. A matching M is maximal if there is no matching

More information

Sources for this lecture. 3. Matching in bipartite and general graphs. Symmetric difference

Sources for this lecture. 3. Matching in bipartite and general graphs. Symmetric difference S-72.2420 / T-79.5203 Matching in bipartite and general graphs 1 3. Matching in bipartite and general graphs Let G be a graph. A matching M in G is a set of nonloop edges with no shared endpoints. Let

More information

Matching and Covering

Matching and Covering Matching and Covering Matchings A matching of size k in a graph G is a set of k pairwise disjoint edges The vertices belonging to the edges of a matching are saturated by the matching; the others are unsaturated

More information

Graph Theory: Matchings and Factors

Graph Theory: Matchings and Factors Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT Kharagpur pallab@cse.iitkgp.ernet.in Matchings A matching of size k in a graph G is a set of k

More information

Matchings. Saad Mneimneh

Matchings. Saad Mneimneh Matchings Saad Mneimneh 1 Stable matching Consider n men and n women. A matching is a one to one correspondence between the men and the women. In finding a matching, however, we would like to respect the

More information

Matchings, Ramsey Theory, And Other Graph Fun

Matchings, Ramsey Theory, And Other Graph Fun Matchings, Ramsey Theory, And Other Graph Fun Evelyne Smith-Roberge University of Waterloo April 5th, 2017 Recap... In the last two weeks, we ve covered: What is a graph? Eulerian circuits Hamiltonian

More information

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes.

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes. Graph Theory II Po-Shen Loh June 009 1 Warm-up 1. Let n be odd. Partition the edge set of K n into n matchings with n 1 edges each. Solution: Spread the n vertices around a circle. Take parallel classes..

More information

APPLIED MECHANISM DESIGN FOR SOCIAL GOOD

APPLIED MECHANISM DESIGN FOR SOCIAL GOOD APPLIED MECHANISM DESIGN FOR SOCIAL GOOD JOHN P DICKERSON Lecture #8 09/22/2016 CMSC828M Tuesdays & Thursdays 12:30pm 1:45pm LET S TALK ABOUT PROJECTS 2 THIS CLASS: MATCHING & NOT THE NRMP 3 OVERVIEW OF

More information

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch. Iterative Improvement Algorithm design technique for solving optimization problems Start with a feasible solution Repeat the following step until no improvement can be found: change the current feasible

More information

Lecture 7: Bipartite Matching

Lecture 7: Bipartite Matching Lecture 7: Bipartite Matching Bipartite matching Non-bipartite matching What is a Bipartite Matching? Let G=(N,A) be an unrestricted bipartite graph. A subset X of A is said to be a matching if no two

More information

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition. 18.433 Combinatorial Optimization Matching Algorithms September 9,14,16 Lecturer: Santosh Vempala Given a graph G = (V, E), a matching M is a set of edges with the property that no two of the edges have

More information

Math and Marriage - Don t Call a Lawyer Yet!

Math and Marriage - Don t Call a Lawyer Yet! Math and Marriage - Don t Call a Lawyer Yet! Ron Gould Emory University Supported by the Heilbrun Distinguished Emeritus Fellowship October 7,27 Philip Hall, 935 Definition By a system of distinct representatives

More information

Ma/CS 6b Class 2: Matchings

Ma/CS 6b Class 2: Matchings Ma/CS 6b Class 2: Matchings By Adam Sheffer Send anonymous suggestions and complaints from here. Email: adamcandobetter@gmail.com Password: anonymous2 There aren t enough crocodiles in the presentations

More information

11.4 Bipartite Multigraphs

11.4 Bipartite Multigraphs 11.4 Bipartite Multigraphs Introduction Definition A graph G is bipartite if we can partition the vertices into two disjoint subsets U and V such that every edge of G has one incident vertex in U and the

More information

2. Matching. Maximum bipartite matchings. Stable marriage problem. Matching 2-1

2. Matching. Maximum bipartite matchings. Stable marriage problem. Matching 2-1 Matching 2-1 2. Matching Maximum bipartite matchings Stable marriage problem Matching 2-2 Matching in graphs given a graph G = (V ; E), a matching M = fe 1; : : :g E is a subset of edges such that no two

More information

MC302 GRAPH THEORY Thursday, 10/24/13

MC302 GRAPH THEORY Thursday, 10/24/13 MC302 GRAPH THEORY Thursday, 10/24/13 Today: Return, discuss HW 3 From last time: Greedy Algorithms for TSP Matchings and Augmenting Paths HW 4 will be posted by tomorrow Reading: [CH] 4.1 Exercises: [CH]

More information

Balls Into Bins Model Occupancy Problems

Balls Into Bins Model Occupancy Problems Balls Into Bins Model Occupancy Problems Assume that m balls are thrown randomly is n bins, i.e., the location of each ball is independently and uniformly chosen at random from the n possibilities. How

More information

Matchings and Covers in bipartite graphs

Matchings and Covers in bipartite graphs Matchings and Covers in bipartite graphs A bipartite graph, also called a bigraph, is a set of graph vertices decomposed into two disjoint sets such that no two graph vertices within the same set are adjacent.

More information

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1.

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1. Lecturer: Scribe: Meena Mahajan Rajesh Chitnis Matchings in Graphs Meeting: 1 6th Jan 010 Most of the material in this lecture is taken from the book Fast Parallel Algorithms for Graph Matching Problems

More information

Network Flow. November 23, CMPE 250 Graphs- Network Flow November 23, / 31

Network Flow. November 23, CMPE 250 Graphs- Network Flow November 23, / 31 Network Flow November 23, 2016 CMPE 250 Graphs- Network Flow November 23, 2016 1 / 31 Types of Networks Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas... CMPE 250 Graphs- Network

More information

Finite Termination of Augmenting Path Algorithms in the Presence of Irrational Problem Data

Finite Termination of Augmenting Path Algorithms in the Presence of Irrational Problem Data Finite Termination of Augmenting Path Algorithms in the Presence of Irrational Problem Data Brian C. Dean Michel X. Goemans Nicole Immorlica June 28, 2006 Abstract This paper considers two similar graph

More information

COMP260 Spring 2014 Notes: February 4th

COMP260 Spring 2014 Notes: February 4th COMP260 Spring 2014 Notes: February 4th Andrew Winslow In these notes, all graphs are undirected. We consider matching, covering, and packing in bipartite graphs, general graphs, and hypergraphs. We also

More information

REU 2006 Discrete Math Lecture 5

REU 2006 Discrete Math Lecture 5 REU 2006 Discrete Math Lecture 5 Instructor: László Babai Scribe: Megan Guichard Editors: Duru Türkoğlu and Megan Guichard June 30, 2006. Last updated July 3, 2006 at 11:30pm. 1 Review Recall the definitions

More information

Discrete Optimization Lecture-11

Discrete Optimization Lecture-11 Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 () Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 1 / 12 A scheduling problem Discussion A company owns 7 ships. During a 12 days period

More information

5 Matchings in Bipartite Graphs and Their Applications

5 Matchings in Bipartite Graphs and Their Applications 5 Matchings in Bipartite Graphs and Their Applications 5.1 Matchings Definition 5.1 A matching M in a graph G is a set of edges of G, none of which is a loop, such that no two edges in M have a common

More information

MATH 682 Notes Combinatorics and Graph Theory II

MATH 682 Notes Combinatorics and Graph Theory II 1 Matchings A popular question to be asked on graphs, if graphs represent some sort of compatability or association, is how to associate as many vertices as possible into well-matched pairs. It is to this

More information

On Galvin s Theorem and Stable Matchings. Adam Blumenthal

On Galvin s Theorem and Stable Matchings. Adam Blumenthal On Galvin s Theorem and Stable Matchings by Adam Blumenthal A thesis submitted to the Graduate Faculty of Auburn University in partial fulfillment of the requirements for the Degree of Master of Science

More information

Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye HW 2

Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye HW 2 CS 70 Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye HW 2 Due Tuesday July 5 at 1:59PM 1. (8 points: 3/5) Hit or miss For each of the claims and proofs below, state whether

More information

Package matchingr. January 26, 2018

Package matchingr. January 26, 2018 Type Package Title Matching Algorithms in R and C++ Version 1.3.0 Date 2018-01-26 Author Jan Tilly, Nick Janetos Maintainer Jan Tilly Package matchingr January 26, 2018 Computes matching

More information

Module 7. Independent sets, coverings. and matchings. Contents

Module 7. Independent sets, coverings. and matchings. Contents Module 7 Independent sets, coverings Contents and matchings 7.1 Introduction.......................... 152 7.2 Independent sets and coverings: basic equations..... 152 7.3 Matchings in bipartite graphs................

More information

Matching Theory. Figure 1: Is this graph bipartite?

Matching Theory. Figure 1: Is this graph bipartite? Matching Theory 1 Introduction A matching M of a graph is a subset of E such that no two edges in M share a vertex; edges which have this property are called independent edges. A matching M is said to

More information

Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching. A maximal matching cannot be enlarged by adding another edge.

Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching. A maximal matching cannot be enlarged by adding another edge. Matchings A matching is a set of (non-loop) edges with no shared endpoints. The vertices incident to an edge of a matching M are saturated by M, the others are unsaturated. A perfect matching of G is a

More information

Lecture 6: Graph Properties

Lecture 6: Graph Properties Lecture 6: Graph Properties Rajat Mittal IIT Kanpur In this section, we will look at some of the combinatorial properties of graphs. Initially we will discuss independent sets. The bulk of the content

More information

MTL 776: Graph Algorithms Lecture : Matching in Graphs

MTL 776: Graph Algorithms Lecture : Matching in Graphs MTL 776: Graph Algorithms Lecture : Matching in Graphs Course Coordinator: Prof. B. S. Panda Note: The note is based on the lectures taken in the class. It is a draft version and may contain errors. It

More information

1. Lecture notes on bipartite matching

1. Lecture notes on bipartite matching Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans February 5, 2017 1. Lecture notes on bipartite matching Matching problems are among the fundamental problems in

More information

The vertex set is a finite nonempty set. The edge set may be empty, but otherwise its elements are two-element subsets of the vertex set.

The vertex set is a finite nonempty set. The edge set may be empty, but otherwise its elements are two-element subsets of the vertex set. Math 3336 Section 10.2 Graph terminology and Special Types of Graphs Definition: A graph is an object consisting of two sets called its vertex set and its edge set. The vertex set is a finite nonempty

More information

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Mathematical and Algorithmic Foundations Linear Programming and Matchings Adavnced Algorithms Lectures Mathematical and Algorithmic Foundations Linear Programming and Matchings Paul G. Spirakis Department of Computer Science University of Patras and Liverpool Paul G. Spirakis

More information

2 Approximation Algorithms for Metric TSP

2 Approximation Algorithms for Metric TSP Comp260: Advanced Algorithms Tufts University, Spring 2002 Professor Lenore Cowen Scribe: Stephanie Tauber Lecture 3: The Travelling Salesman Problem (TSP) 1 Introduction A salesman wishes to visit every

More information

Ma/CS 6b Class 4: Matchings in General Graphs

Ma/CS 6b Class 4: Matchings in General Graphs Ma/CS 6b Class 4: Matchings in General Graphs By Adam Sheffer Reminder: Hall's Marriage Theorem Theorem. Let G = V 1 V 2, E be a bipartite graph. There exists a matching of size V 1 in G if and only if

More information

PERFECT MATCHING THE CENTRALIZED DEPLOYMENT MOBILE SENSORS THE PROBLEM SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS OF MOBILE SENSORS

PERFECT MATCHING THE CENTRALIZED DEPLOYMENT MOBILE SENSORS THE PROBLEM SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS OF MOBILE SENSORS SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS THE CENTRALIZED DEPLOYMENT OF MOBILE SENSORS I.E. THE MINIMUM WEIGHT PERFECT MATCHING 1 2 ON BIPARTITE GRAPHS Prof. Tiziana Calamoneri Network Algorithms

More information

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets EECS 310: Discrete Math Lecture 5 Graph Theory, Matching Reading: MIT OpenCourseWare 6.042 Chapter 5.1-5.2 Induction Review Basic Induction: Want to prove P (n). Prove base case P (1). Prove P (n) P (n+1)

More information

Popular matchings with two-sided preferences and one-sided ties

Popular matchings with two-sided preferences and one-sided ties Popular matchings with two-sided preferences and one-sided ties Ágnes Cseh 1, Chien-Chung Huang 2, and Telikepalli Kavitha 3 1 TU Berlin, Germany. cseh@math.tu-berlin.de 2 Chalmers University, Sweden.

More information

Assignment and Matching

Assignment and Matching Assignment and Matching By Geetika Rana IE 680 Dept of Industrial Engineering 1 Contents Introduction Bipartite Cardinality Matching Problem Bipartite Weighted Matching Problem Stable Marriage Problem

More information

Greedy Homework Problems

Greedy Homework Problems CS 1510 Greedy Homework Problems 1. (2 points) Consider the following problem: INPUT: A set S = {(x i, y i ) 1 i n} of intervals over the real line. OUTPUT: A maximum cardinality subset S of S such that

More information

Jessica Su (some parts copied from CLRS / last quarter s notes)

Jessica Su (some parts copied from CLRS / last quarter s notes) 1 Max flow Consider a directed graph G with positive edge weights c that define the capacity of each edge. We can identify two special nodes in G: the source node s and the sink node t. We want to find

More information

CPSC W1: Midterm #1 (Group Version) Thu

CPSC W1: Midterm #1 (Group Version) Thu CPSC 320 2016W1: Midterm #1 (Group Version) 2016-10-20 Thu 1 2 1 O'd to a Pair of Runtimes [10 marks] Consider the following pairs of functions (representing algorithm runtimes), expressed in terms of

More information

CS483 Analysis of Algorithms Lecture 09 Linear Programming 01

CS483 Analysis of Algorithms Lecture 09 Linear Programming 01 CS483 Analysis of Algorithms Lecture 09 Linear Programming 01 Jyh-Ming Lien April 09, 2009 this lecture note is based on Algorithms by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani and to the Design

More information

1 Matchings in Graphs

1 Matchings in Graphs Matchings in Graphs J J 2 J 3 J 4 J 5 J J J 6 8 7 C C 2 C 3 C 4 C 5 C C 7 C 8 6 J J 2 J 3 J 4 J 5 J J J 6 8 7 C C 2 C 3 C 4 C 5 C C 7 C 8 6 Definition Two edges are called independent if they are not adjacent

More information

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

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Recap: Stable Matching Problem Definition of a Stable Matching Stable Roomate Matching Problem Stable matching does not

More information

Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching

Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching Bipartite Matching Matching 3330: Algorithms A graph is bipartite if its vertex set can be partitioned into two subsets A and B so that each edge has one endpoint in A and the other endpoint in B. A B

More information

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12. AMS 550.47/67: Graph Theory Homework Problems - Week V Problems to be handed in on Wednesday, March : 6, 8, 9,,.. Assignment Problem. Suppose we have a set {J, J,..., J r } of r jobs to be filled by a

More information

CPSC W1: Midterm #1

CPSC W1: Midterm #1 CPSC 320 2016W1: Midterm #1 2016-10-20 Thu 1 O'd to a Pair of Runtimes [10 marks] Consider the following pairs of functions (representing algorithm runtimes), expressed in terms of the positive variables

More information

Matching in Bipartite Graphs

Matching in Bipartite Graphs July 2, 2014 We have a bipartite graph G = (C, R, E) where R represents a set of resources and C represents a set of customers. The edge set shows a customer in C likes (willing to have) a subset of resources

More information

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel. CS261, Winter 2017. Instructor: Ashish Goel. Problem set 2 Electronic submission to Gradescope due 11:59pm Thursday 2/16. Form a group of 2-3 students that is, submit one homework with all of your names.

More information

Part 1. An Implementation of the Gale-Shapley Algorithm

Part 1. An Implementation of the Gale-Shapley Algorithm Part 1 An Implementation of the Gale-Shapley Algorithm CSCI 3110 Code Fall 2015 1 Introduction Here s the pseudo-code of the Gale-Shapley algorithm from class: GALESHAPLEY(M, W ) while there is an unmarried

More information

Solutions to Math 381 Quiz 2

Solutions to Math 381 Quiz 2 Solutions to Math 381 Quiz 2 November 7, 2018 (1) In one sentence, what is the goal of your class project? Each team has a different answer here. (2) Write a function in Python which computes a linear

More information

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Midterm 1

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Midterm 1 CS 70 Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Midterm 1 PRINT Your Name:, (last) SIGN Your Name: (first) PRINT Your Student ID: CIRCLE your exam room: 1 Pimentel 141 Mccone

More information

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs Approximation slides 1 An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs Approximation slides 2 Linear independence A collection of row vectors {v T i } are independent

More information

1. Lecture notes on bipartite matching February 4th,

1. Lecture notes on bipartite matching February 4th, 1. Lecture notes on bipartite matching February 4th, 2015 6 1.1.1 Hall s Theorem Hall s theorem gives a necessary and sufficient condition for a bipartite graph to have a matching which saturates (or matches)

More information

PERFECT MATCHING THE CENTRALIZED DEPLOYMENT MOBILE SENSORS THE PROBLEM SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS OF MOBILE SENSORS

PERFECT MATCHING THE CENTRALIZED DEPLOYMENT MOBILE SENSORS THE PROBLEM SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS OF MOBILE SENSORS SECOND PART: WIRELESS NETWORKS.B. SENSOR NETWORKS THE CENTRALIZED DEPLOYMENT OF MOBILE SENSORS I.E. THE MINIMUM WEIGHT PERFECT MATCHING ON BIPARTITE GRAPHS Prof. Tiziana Calamoneri Network Algorithms A.y.

More information

September 4, Input: two strings s 1 and s 2 of length n. s 1 = AGGCTACC s 2 = CAGGCTAC

September 4, Input: two strings s 1 and s 2 of length n. s 1 = AGGCTACC s 2 = CAGGCTAC COMPSCI 311: Introduction to Algorithms COMPSCI 311: Introduction to Algorithms Marius Minea marius@cs.umass.edu University of Massachusetts Amherst slides credit: Akshay Krishnamurthy, Andrew McGregor,

More information

Graphs and Algorithms 2015

Graphs and Algorithms 2015 Graphs and Algorithms 2015 Teachers: Nikhil Bansal and Jorn van der Pol Webpage: www.win.tue.nl/~nikhil/courses/2wo08 (for up to date information, links to reading material) Goal: Have fun with discrete

More information

Let s Talk About Logic

Let s Talk About Logic Let s Talk About Logic Jan van Eijck CWI & ILLC, Amsterdam Masterclass Logica, 2 Maart 2017 Abstract This lecture shows how to talk about logic in computer science. To keep things simple, we will focus

More information

5.1 Min-Max Theorem for General Matching

5.1 Min-Max Theorem for General Matching CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: General Matching Date: 4/01/008 Lecturer: Lap Chi Lau Scribe: Jennifer X.M. WU In this lecture, we discuss matchings in general graph.

More information

Abstract. A graph G is perfect if for every induced subgraph H of G, the chromatic number of H is equal to the size of the largest clique of H.

Abstract. A graph G is perfect if for every induced subgraph H of G, the chromatic number of H is equal to the size of the largest clique of H. Abstract We discuss a class of graphs called perfect graphs. After defining them and getting intuition with a few simple examples (and one less simple example), we present a proof of the Weak Perfect Graph

More information

Advanced Combinatorial Optimization September 17, Lecture 3. Sketch some results regarding ear-decompositions and factor-critical graphs.

Advanced Combinatorial Optimization September 17, Lecture 3. Sketch some results regarding ear-decompositions and factor-critical graphs. 18.438 Advanced Combinatorial Optimization September 17, 2009 Lecturer: Michel X. Goemans Lecture 3 Scribe: Aleksander Madry ( Based on notes by Robert Kleinberg and Dan Stratila.) In this lecture, we

More information

2. Lecture notes on non-bipartite matching

2. Lecture notes on non-bipartite matching Massachusetts Institute of Technology 18.433: Combinatorial Optimization Michel X. Goemans February 15th, 013. Lecture notes on non-bipartite matching Given a graph G = (V, E), we are interested in finding

More information

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn Graphs Extremely important concept in computer science Graph, : node (or vertex) set : edge set Simple graph: no self loops, no multiple

More information

1 Unweighted Set Cover

1 Unweighted Set Cover Comp 60: Advanced Algorithms Tufts University, Spring 018 Prof. Lenore Cowen Scribe: Yuelin Liu Lecture 7: Approximation Algorithms: Set Cover and Max Cut 1 Unweighted Set Cover 1.1 Formulations There

More information

Finding a princess in a palace: A pursuit evasion problem

Finding a princess in a palace: A pursuit evasion problem Finding a princess in a palace: A pursuit evasion problem John R. Britnell Department of Mathematics Imperial College London London SW7 2AZ United Kingdom j.britnell@imperial.ac.uk Mark Wildon Department

More information

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

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2019 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2019 Recap: Stable Matching Problem Definition of Stable Matching Problem Gale-Shapley Algorithm Unengaged men propose to

More information

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem CS61: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem Tim Roughgarden February 5, 016 1 The Traveling Salesman Problem (TSP) In this lecture we study a famous computational problem,

More information

8 NP-complete problem Hard problems: demo

8 NP-complete problem Hard problems: demo Ch8 NPC Millennium Prize Problems http://en.wikipedia.org/wiki/millennium_prize_problems 8 NP-complete problem Hard problems: demo NP-hard (Non-deterministic Polynomial-time hard), in computational complexity

More information

6. Lecture notes on matroid intersection

6. Lecture notes on matroid intersection Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans May 2, 2017 6. Lecture notes on matroid intersection One nice feature about matroids is that a simple greedy algorithm

More information

Lecture 11: Maximum flow and minimum cut

Lecture 11: Maximum flow and minimum cut Optimisation Part IB - Easter 2018 Lecture 11: Maximum flow and minimum cut Lecturer: Quentin Berthet 4.4. The maximum flow problem. We consider in this lecture a particular kind of flow problem, with

More information

Discrete Mathematics and Probability Theory Fall 2015 Rao Midterm 1

Discrete Mathematics and Probability Theory Fall 2015 Rao Midterm 1 CS 70 Discrete Mathematics and Probability Theory Fall 2015 Rao Midterm 1 PRINT Your Name:, (last) SIGN Your Name: (first) PRINT Your Student ID: CIRCLE your exam room: 2050 VLSB A1 Hearst Annex 120 Latimer

More information

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points MC 0 GRAPH THEORY 0// Solutions to HW # 0 points + XC points ) [CH] p.,..7. This problem introduces an important class of graphs called the hypercubes or k-cubes, Q, Q, Q, etc. I suggest that before you

More information

1 Matching in Non-Bipartite Graphs

1 Matching in Non-Bipartite Graphs CS 369P: Polyhedral techniques in combinatorial optimization Instructor: Jan Vondrák Lecture date: September 30, 2010 Scribe: David Tobin 1 Matching in Non-Bipartite Graphs There are several differences

More information

On the Stable Marriage of Maximum Weight Royal Couples

On the Stable Marriage of Maximum Weight Royal Couples On the Stable Marriage of Maximum Weight Royal Couples Anan Marie, Avigdor Gal Technion Israel Institute of Technology Haifa 32000, Israel {sananm@cs,avigal@ie}.technion.ac.il Abstract In this paper we

More information

5. Lecture notes on matroid intersection

5. Lecture notes on matroid intersection Massachusetts Institute of Technology Handout 14 18.433: Combinatorial Optimization April 1st, 2009 Michel X. Goemans 5. Lecture notes on matroid intersection One nice feature about matroids is that a

More information

Minimum Maximal Matching Is NP-Hard in Regular Bipartite Graphs

Minimum Maximal Matching Is NP-Hard in Regular Bipartite Graphs Minimum Maximal Matching Is NP-Hard in Regular Bipartite Graphs M. Demange 1 and T. Ekim 2, 1 ESSEC Business School, Avenue Bernard HIRSH, BP 105, 95021 Cergy Pontoise cedex France demange@essec.fr 2 Boğaziçi

More information

Figure 2.1: A bipartite graph.

Figure 2.1: A bipartite graph. Matching problems The dance-class problem. A group of boys and girls, with just as many boys as girls, want to dance together; hence, they have to be matched in couples. Each boy prefers to dance with

More information

GRAPH THEORY: AN INTRODUCTION

GRAPH THEORY: AN INTRODUCTION GRAPH THEORY: AN INTRODUCTION BEGINNERS 3/4/2018 1. GRAPHS AND THEIR PROPERTIES A graph G consists of two sets: a set of vertices V, and a set of edges E. A vertex is simply a labeled point. An edge is

More information

Review implementation of Stable Matching Survey of common running times. Turn in completed problem sets. Jan 18, 2019 Sprenkle - CSCI211

Review implementation of Stable Matching Survey of common running times. Turn in completed problem sets. Jan 18, 2019 Sprenkle - CSCI211 Objectives Review implementation of Stable Matching Survey of common running times Turn in completed problem sets Jan 18, 2019 Sprenkle - CSCI211 1 Review: Asymptotic Analysis of Gale-Shapley Alg Not explicitly

More information

Implementing Algorithms

Implementing Algorithms Implementing Algorithms 1 Data Structures implementing algorithms arrays and linked lists 2 Implementing the Gale-Shapley algorithm selecting data structures overview of the selected data structures 3

More information

Review for Midterm Exam

Review for Midterm Exam Review for Midterm Exam 1 Policies and Overview midterm exam policies overview of problems, algorithms, data structures overview of discrete mathematics 2 Sample Questions on the cost functions of algorithms

More information

CS612 Algorithms for Electronic Design Automation

CS612 Algorithms for Electronic Design Automation CS612 Algorithms for Electronic Design Automation Lecture 8 Network Flow Based Modeling 1 Flow Network Definition Given a directed graph G = (V, E): Each edge (u, v) has capacity c(u,v) 0 Each edge (u,

More information

Coalitional Permutation Manipulations in the Gale-Shapley Algorithm

Coalitional Permutation Manipulations in the Gale-Shapley Algorithm Coalitional Permutation Manipulations in the Gale-Shapley Algorithm Yuan Deng Duke University ericdy@cs.duke.edu Weiran Shen IIIS, Tsinghua University emersonswr@gmail.com Pingzhong Tang IIIS, Tsinghua

More information

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm.

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm. Today Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm. Finding an inverse? We showed how to efficiently tell if there is an inverse. Extend euclid to find inverse. Euclid s GCD algorithm.

More information

CPSC 320 Midterm #1. February 4, 2015

CPSC 320 Midterm #1. February 4, 2015 CPSC 320 Midterm #1 February 4, 2015 1 2 Reminders (but do not miss the problem also on this page!): ˆ f(n) O(g(n)) (big-o, that is) exactly when there is a positive real constant c and positive integer

More information

Vertex 3-colorability of claw-free graphs

Vertex 3-colorability of claw-free graphs Algorithmic Operations Research Vol.2 (27) 5 2 Vertex 3-colorability of claw-free graphs Marcin Kamiński a Vadim Lozin a a RUTCOR - Rutgers University Center for Operations Research, 64 Bartholomew Road,

More information

Graph theory - solutions to problem set 1

Graph theory - solutions to problem set 1 Graph theory - solutions to problem set 1 1. (a) Is C n a subgraph of K n? Exercises (b) For what values of n and m is K n,n a subgraph of K m? (c) For what n is C n a subgraph of K n,n? (a) Yes! (you

More information

Graph Algorithms Matching

Graph Algorithms Matching Chapter 5 Graph Algorithms Matching Algorithm Theory WS 2012/13 Fabian Kuhn Circulation: Demands and Lower Bounds Given: Directed network, with Edge capacities 0and lower bounds l for Node demands for

More information

Efficiency and Respecting Improvements in College Admissions

Efficiency and Respecting Improvements in College Admissions Efficiency and Respecting Improvements in College Admissions Zhenhua Jiao School of Economics Shanghai University of Finance and Economics Shanghai, 200433, China Guoqiang Tian Department of Economics

More information

6.006 Introduction to Algorithms. Lecture 25: Complexity Prof. Erik Demaine

6.006 Introduction to Algorithms. Lecture 25: Complexity Prof. Erik Demaine 6.006 Introduction to Algorithms Lecture 25: Complexity Prof. Erik Demaine Today Reductions between problems Decision vs. optimization problems Complexity classes P, NP, co NP, PSPACE, EXPTIME, NP completeness

More information

Homework 3 Solutions

Homework 3 Solutions CS3510 Design & Analysis of Algorithms Section A Homework 3 Solutions Released: 7pm, Wednesday Nov 8, 2017 This homework has a total of 4 problems on 4 pages. Solutions should be submitted to GradeScope

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Basics A 4 credit unit course Part of Theoretical Computer Science courses at the Laboratory of Mathematics There will be 4 hours

More information

/ Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang

/ Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang 600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Linear Programming Date: 2/24/15 Scribe: Runze Tang 9.1 Linear Programming Suppose we are trying to approximate a minimization

More information

Math 776 Graph Theory Lecture Note 1 Basic concepts

Math 776 Graph Theory Lecture Note 1 Basic concepts Math 776 Graph Theory Lecture Note 1 Basic concepts Lectured by Lincoln Lu Transcribed by Lincoln Lu Graph theory was founded by the great Swiss mathematician Leonhard Euler (1707-178) after he solved

More information

Ma/CS 6b Class 5: Graph Connectivity

Ma/CS 6b Class 5: Graph Connectivity Ma/CS 6b Class 5: Graph Connectivity By Adam Sheffer Communications Network We are given a set of routers and wish to connect pairs of them to obtain a connected communications network. The network should

More information