Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bipartite Matching, Extremal Problems, Matrix Tree Theorem.

Similar presentations


Presentation on theme: "Bipartite Matching, Extremal Problems, Matrix Tree Theorem."— Presentation transcript:

1 Bipartite Matching, Extremal Problems, Matrix Tree Theorem.

2 Today’s Plan Proof of Hall’s theorem Algorithms for bipartite matching Extremal problems Matrix tree theorem

3 Perfect Matching Does a perfect matching always exist? Of course not. S N(S) If there are more vertices on one side, then of course it is impossible. Let N(S) be the neighbours of vertices in S. If |N(S)| < |S|, then it is impossible to have a perfect matching.

4 A Necessary and Sufficient Condition Hall’s Theorem: A bipartite graph G=(V,W;E) has a perfect matching if and only if |N(S)| >= |S| for every subset S of V and W. This is a deep theorem. It tells you exactly when a bipartite graph does not have a perfect matching. (Now you can convince the king.) Is it the only situation when a bipartite graph does not have a perfect matching?

5 Proof of Hall’s Theorem (easy direction) One direction is easy, if there is a perfect matching, then |N(S)| >= |S| for every subset S of V. S N(S) Just consider the neighbours of S in the perfect matching. Hall’s Theorem: A bipartite graph G=(V,W;E) has a perfect matching if and only if |N(S)| >= |S| for every subset S of V.

6 Proof of Hall’s Theorem (difficult direction) Another direction is more interesting, we need to show whenever |N(S)| >= |S|, then there is a perfect matching! How to prove such kind of statement? Proof by strong induction on the number of edges. Hall’s Theorem: A bipartite graph G=(V,W;E) has a perfect matching if and only if |N(S)| >= |S| for every subset S of V.

7 Hall’s Theorem: If |N(S)| >= |S| for every subset S of V, then there is a perfect matching. Proof of Hall’s Theorem Case 1: Every subset S has |N(S)| > |S|. (Easy case) 1.Just delete an edge. 2.By deleting an edge, |N(S)| can decrease by at most 1. 3.Since |N(S)| > |S| before, 4.we still have |N(S)| >= |S| after deleting an edge. 5.Since the graph is smaller (one fewer edge), by induction, 6.there is a perfect matching in this smaller graph, 7.hence there is a perfect matching in the original graph.

8 Hall’s Theorem: If |N(S)| >= |S| for every subset S of V, then there is a perfect matching. Proof of Hall’s Theorem Case 2: Suppose there is a subset S with |N(S)| = |S|. S N(S) Divide the graph into two smaller graphs G1 and G2 (so we can apply induction) Find a perfect matching in G2 by induction. Find a perfect matching in G1 by induction. G1 G2 Then we are done.

9 Proof of Hall’s Theorem S N(S) Why there is a perfect matching in G2? To apply Hall’s, we want to show for any subset T of S, |N(T) G2| >= |T|. T|N(T) G2| G2 Hall’s Theorem: If |N(S)| >= |S| for every subset S of V, then there is a perfect matching.

10 Proof of Hall’s Theorem S N(S) Why there is a perfect matching in G2? For any subset T S, N(T) G2 = N(T). By assumption, |N(T) G2| = |N(T)| >= |T|. Therefore, by induction, there is a perfect matching in G2. T G2 Find a perfect matching in G2 by induction. |N(T) G2|

11 Why there is a perfect matching in G1? Proof of Hall’s Theorem S N(S) T N(T) G1 For any subset T, we want to show |N(T) G1| >= |T| to apply induction. 1.Consider T, by assumption, |N(T)| >= |T| 2.Can we conclude that |N(T) G1| >= |T|? 3.No, because N(T) may intersect N(S)! Now what?

12 Why there is a perfect matching in G1? Proof of Hall’s Theorem S N(S) T N(T) G1 |S|=|N(S)| For any subset T, we want to show |N(T) G1| >= |T| to apply induction. 1.Consider S T, by assumption, |N(S T)| >= |S T| (the green areas). 2.Since |S|=|N(S)|, |N(S T) – N(S)| >= |S T - S| (the red areas). 3.So |N(T) G1| = |N(S T) – N(S)| > = |S T – S| = |T|, as required.

13 Hall’s Theorem: If |N(S)| >= |S| for every subset S of V, then there is a perfect matching. Proof of Hall’s Theorem Case 2: Suppose there is a subset S with |N(S)| = |S|. S N(S) Divide the graph into two smaller graphs G1 and G2 (so we can apply induction) Find a perfect matching in G2 by induction. Find a perfect matching in G1 by induction. G1 G2 Now we are done.

14 Today’s Plan Proof of Hall’s theorem Algorithms for bipartite matching Extremal problems Matrix tree theorem

15 Greedy method? (add an edge with both endpoints unmatched) First Try

16 Key Questions How to tell if a graph does not have a (perfect) matching? How to determine the size of a maximum matching? How to find a maximum matching efficiently?

17 Hall’s Theorem [1935]: A bipartite graph G=(A,B;E) has a matching that “saturates” A if and only if |N(S)| >= |S| for every subset S of A. S N(S) Existence of Perfect Matching

18 König [1931]: In a bipartite graph, the size of a maximum matching is equal to the size of a minimum vertex cover. What is a good upper bound on the size of a maximum matching? Min-max theoremNP and co-NP Implies Hall’s theorem. Bound for Maximum Matching König [1931]: In a bipartite graph, the size of a maximum matching is equal to the size of a minimum vertex cover.

19 Any idea to find a larger matching? Algorithmic Idea?

20 Given a matching M, an M-alternating path is a path that alternates between edges in M and edges not in M. An M-alternating path whose endpoints are unmatched by M is an M-augmenting path. Augmenting Path

21 What if there is no more M-augmenting path? Prove the contrapositive: A bigger matching  an M-augmenting path 1.Consider 2.Every vertex in has degree at most 2 3.A component in is an even cycle or a path 4.Since, an M-augmenting path! If there is no M-augmenting path, then M is maximum! Optimality Condition

22 Algorithm Key: M is maximum  no M-augmenting path How to find efficiently?

23 Finding M-augmenting paths Orient the edges (edges in M go up, others go down) An M-augmenting path  a directed path between two unmatched vertices

24 Complexity At most n iterations An augmenting path in time by a DFS or a BFS Total running time

25 Hall’s Theorem [1935]: A bipartite graph G=(A,B;E) has a matching that “saturates” A if and only if |N(S)| >= |S| for every subset S of A. König [1931]: In a bipartite graph, the size of a maximum matching is equal to the size of a minimum vertex cover. Idea: consider why the algorithm got stuck… Minimum Vertex Cover

26 Today’s Plan Proof of Hall’s theorem Algorithms for bipartite matching Extremal problems Matrix tree theorem


Download ppt "Bipartite Matching, Extremal Problems, Matrix Tree Theorem."

Similar presentations


Ads by Google