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] p. 127: 4.1.1, 4.1.2, 4.1.9 Thursday, 10/24/13, Slide #1
Matching Problems Marriage Problem k men and m women, and each male-female pair has expressed whether or not they are willing to marry. Find the maximum number of pairs of willing mates. Personnel Assignment Problem k workers X 1,, X k and m jobs Y 1,, Y m. Each worker is qualified to do some jobs, but not others. Assign workers to jobs so that number of assignments is maximized. Optimal Assignment Problem Each worker X i and job Y j is given a weight w ij indicating the effectiveness of assigning worker X i to job Y j. Assign workers to jobs so that the total effectiveness of the assignments of assignments is maximized. Thursday, 10/24/13, Slide #2
Matchings Definition: Let G be a graph. A matching in G is a set M of edges, no two of which share an endpoint. A vertex that is an endpoint of an edge in the matching M is called M-saturated; otherwise it s M-unsaturated. G does not need to bipartite, but in applications it often is. A B C D E F G H 010 110 011 111 1 101 0 1 Thursday, 10/24/13, Slide #3
Maximum and Perfect Matchings A matching M is maximum if it has the largest size (# of edges) among all possible matchings. A matching M is perfect (or complete) if every vertex in G is incident with an edge in the matching. Does maximum imply perfect? Does perfect imply maximum? Thursday, 10/24/13, Slide #4
Matchings in familiar graphs and (cycle & path on n vertices): What s the size of a maximum matching? What conditions on permit a perfect matching?,, assume : What s the size of a maximum matching? What conditions on, permit a perfect matching? : What s the size of a maximum matching? What conditions on permit a perfect matching? Thursday, 10/24/13, Slide #5
Making a matching bigger: Alternating and Augmenting paths If G has a matching M, an M-alternating path is a path that alternates between edges in and not in M. An M-augmenting path is an M- alternating path whose endpoints are not incident with any M-edges. Give two M-alternating paths in the graph at right, one M-augmenting, one not. A transfer along an M-augmenting path P creates a new matching M by removing from M the matched edges on P and adding to M the unmatched edges on P How is the size of M related to the size of M? a d g b e f h j c i Thursday, 10/24/13, Slide #6
Berge's Theorem Berge s Theorem. A matching M is maximum if and only if it has no M-augmenting paths. Proof. (î): If M is maximum, then there can't be an M-augmenting path why? For other direction (í), prove contrapositive: If M is not maximum, then there is an M-augmenting path. Let M' be a matching with more edges than M. Let H = M D M' = (M \ M ) (M \ M) = the edges that are in M or M', but not both (called their symmetric difference). Thursday, 10/24/13, Slide #7
Properties of H = M M' 1. All vertices in H have degree 1 or 2, so each component of H is a path or a cycle. 2. The edges on each path or cycle must alternately be in M and M. 3. Since M' > M, H has more edges from M' than from M. 4. It follows from (1-3) that some component of H has more edges of M' than M, and therefore must be an M-augmenting path. This is what we wanted to prove! Thursday, 10/24/13, Slide #8
Edmonds's Matching Algorithm Input: A graph G and a matching M (including the empty matching), Output: A maximum matching. 1. Pick any unmatched vertex v in the matching. 2. Grow an M-alternating tree from v. 3a. If any M-augmenting path P is found (i.e., if you reach an unmatched vertex), do a transfer along P, creating a larger matching M. Repeat from Step 1 using the matching M. 3b. If no M-augmenting path is found, grow a tree from another unmatched vertex. Repeat until either all vertices are matched or all have been examined without finding any M-alternating paths. Thursday, 10/24/13, Slide #9
Examples Each graph below has a matching M (in red). In each graph find an M-augmenting path to extend the matching. Thursday, 10/24/13, Slide #10