1 / 25

Maximum Bipartite Matching

Maximum Bipartite Matching. M-augmenting path: A path that alternates between edges in M and edges not in M and has endpoints unsaturated by M. Theorem 3.10: A matching M is a maximum matching in G iff G has no M-augmenting path. We can enlarge M if M-augmenting path exists. X. Y. The Idea.

renee-frye
Download Presentation

Maximum Bipartite Matching

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Maximum Bipartite Matching • M-augmenting path:A path that alternates between edges in M and edges not in M and has endpoints unsaturated by M. • Theorem 3.10: A matching M is a maximum matching in G iff G has no M-augmenting path. • We can enlarge M if M-augmenting path exists. X Y

  2. The Idea • Iteratively seek augmenting paths to enlarge the current matching till no M-augmenting path can be found.

  3. How to seek M-augmenting path? X • Let U be the set of M-unsaturated vertices in X. One endpoint of an M-augmenting path is in U. • If node x is in U and xyE(G) for some unsaturated node y, then an M-augmenting path is found. • Let SX be the set of vertices reached by exploring M-alternating paths from U. If node x is in S and xyE(G) for some unsaturated node y, then an M-augmenting path is found. Y

  4. How to seek M-augmenting path? S x x x x x U X w w w y y y Y T

  5. Algorithm 3.2.1 1. S=U and T=. 2. If S has no unmarked vertex, stop and report T(X-S) as a minimum cover and M as a maximum matching. 3. Explore alternating path from an unmark xS. 3.1. If there exists unsaturated yN(x) such that xyM, then stop and report an M-augmenting path from U to y. 3.2. For each xyE(G), include y in T and include w in S, where ywM. Mark x and Goto Step 2.

  6. Theorem 3.2.2 • Repeatedly applying Algorithm 3.2.1 to a bipartite graph produces a matching and a vertex cover of equal size

  7. How to show the current matching M has maximum size? • Theorem 3.1.16: If G is a bipartite graph, then the maximum size of a matching in G equals to the minimum size of a vertex cover in G • Find a vertex cover with the same size as the current matching • It goes to show T(X-S) is a vertex over with the same size as the current matching M.

  8. T(X-S) is a vertex cover • No edge joins S to Y-T. S X-S X Y T Y-T

  9. |M|= |T|+|X-S| • |M|<= |T|+|X-S| • T(X-S) is a vertex cover • |M| >= |T|+|X-S| edges. • Each yT is M-saturated. • Each vertex of X-S is M-saturated. • No edge in M joins T to X-S. S X-S X Y T Y-T

  10. Maximum Weighted Bipartite Matching • A farming company owns n farms and n processing plants. The profit that results from sending the output of farm i to plant j is wi,j. • The company wants to select edges forming a matching to maximize total profit. v1 v2 v3 u2 u3 u1 u1 u2 v1 v2 v3 u3 Edge weight Wi,j w(M)=6+5+8=19

  11. u2 u3 u1 v1 v2 v3 Minimum Weighted Cover • The government will pay ui if the company agrees not to use farm i and vj if it agrees not to use plant j. • The government must offer amounts such that ui+vj>=wi,j for all i, j. Otherwise, the company makes more by using edge xiyj than taking the government payments for those vertices. • The government wants to minimize ui+vj. v1 v2 v3 c(u) 4 5 7 u1 u2 u3 c(v) 0 2 1 Edge weight Wi,j c(u,v)=19

  12. u2 u3 u1 v1 v2 v3 Lemma 3.2.7: Duality of minimum c(u,v) and maximum w(M) • For a perfect matching M and weighted cover (u,v) in a weighted bipartite graph G, (1) c(u,v)>=w(M) (2) c(u,v) =w(M) iff M consists of edges xiyj such that ui+vj=wi,j. In (2), M and c(u,v) are optimal. since ui+vj>=wi,j for all i, j. 4 5 7 c(u) u2 u3 u1 v1 v2 v3 c(v) 0 2 1 w(M)=6+5+8=19 c(u,v)=19

  13. Equality Subgraph • Equality Subgraph: The equality subgraph Gu,v for a weighted cover (u,v) is the spanning subgraph of Kn,n whose edges are the pairs xiyj such that ui+vj=wi,j. • In the cover, the excess for i,j is ui+vj-wi,j. Kn,n v1 v2 v3 c(u) 4 5 7 u2 u3 u1 u1 u2 u3 v1 v2 v3 c(v) 0 2 1 Edge weight Wi,j

  14. Algorithm 3.2.9 • Input: A matrix of weights on the edges of Kn,n with bipartition X,Y. • Output: A maximum weighted matching. • Idea: Iteratively adjust the cover (u,v) until the equality subgraph Gu,v has a perfect matching.

  15. Algorithm 3.2.9 • Initialization: Let (u,v) be a cover, such that ui=maxj wi,j and vj=0. 0 0 0 0 0 4 1 6 2 3 5 0 3 7 6 2 3 4 5 8 3 4 6 3 4 4 6 5 8 6 6 7 8 6 8

  16. Algorithm 3.2.9 0 0 0 0 0 4 1 6 2 3 5 0 3 7 6 2 3 4 5 8 3 4 6 3 4 4 6 5 8 6 6+0-4 6+0-1 6+0-6 6+0-2 6+0-3 7+0-5 7+0-0 7+0-3 7+0-7 7+0-6 8+0-2 8+0-3 8+0-4 8+0-5 8+0-8 6+0-3 6+0-4 6+0-6 6+0-3 6+0-4 8+0-4 8+0-6 8+0-5 8+0-8 8+0-6 excess matrix 6 7 8 6 8 R 2 5 0 4 3 2 7 4 0 1 6 5 4 3 0 3 2 0 3 2 4 2 3 0 2 X R Y T T T T

  17. Algorithm 3.2.9 • How to adjust the cover (u,v) such that the equality subgraph Gu,v has a perfect matching? • Add any edge incident to a vertex in Q=RT into Gu,v does not work. • Decrease the excess for each edge not incident to a vertex in Q=RT. • No edge has a negative excess after adjusting the cover (u,v).

  18. Algorithm 3.2.9 0 0 00 0 R 2 5 0 4 3 2 7 4 0 1 6 5 4 3 0 3 2 0 3 2 4 2 3 0 2 6 7 8 6 8 min X ε R Y T T T T T T T ε 0 0 1+1 1+10+1 min 0 0 000 +1 +1 0 3 0 4 2 0 5 4 0 0 5 4 5 4 0 1 0 0 3 1 2 0 3 0 1 5-1 6-1 8-1 5-1 7-1 6-1 7-1 8 6-1 8-1 1 4 0 4 2 1 6 4 0 0 6 5 5 4 0 2 1 0 3 1 5 1 3 0 1 TTT

  19. Algorithm 3.2.9 1. Find a maximum matching M in Gu,v. If M is perfect matching, stop and report M as a maximum weighted matching. 2. Let Q be a vertex cover of size |M| in Gu,v. Let R=XQ and T=YQ. Let ε=min{ui+vj- wi,j: xiX-R, yjY-T}. 3. Decreases ui by εfor xiX-R, and increases vj by εfor yjT. 4. Form the new equality graph and Goto Step 1.

  20. Theorem 3.2.11 • Algorithm 3.2.9 finds a maximum weight matching and a minimum cost cover • Let (u,v) be the current cover and suppose that the equality subgraph has no perfect matching. Let (u’,v’) be the new lists of numbers assigned to the vertices. • Show (u’,v’) is a cover by discuss 3 cases: 1) edge from X-R to T or from R to Y-T, 2) edges from R to T, and 3) edge from X-R to Y-T.

  21. Theorem 3.2.11 Case 1: ui’+vj’= ui+vj for edges xiyj from X-R to T or from R to Y-T.  (u’,v’) is a cover 0 0 00 0 0 0 0+1 0+1 0 2 5 0 4 3 2 7 4 0 1 6 5 4 3 0 3 2 0 3 2 4 2 3 0 2 6 7 8 6 8 6-1 7-1 8 6-1 8-1 1 4 0 4 2 1 6 4 0 0 6 5 5 4 0 2 1 0 3 1 5 1 3 0 1 R R T T T T

  22. Theorem 3.2.11 Case 2: ui’+vj’= ui+vj+ε for edges xiyj from R to T.  (u’,v’) is a cover 0 0 00 0 0 0 0+1 0+1 0 2 5 0 4 3 2 7 4 0 1 6 5 4 3 0 3 2 0 3 2 4 2 3 0 2 6 7 8 6 8 6-1 7-1 8 6-1 8-1 1 4 0 4 2 1 6 4 0 0 6 5 5 4 0 2 1 0 3 1 5 1 3 0 1 R R T T T T

  23. Theorem 3.2.11 Case 3: ui’+vj’= ui+vj-ε for edges xiyj from X-R to Y-T. (u’,v’) is a cover since ε=min{ui+vj- wi,j: xiX-R, yjY-T}. 0 0 00 0 0 0 0+1 0+1 0 2 5 0 4 3 2 7 4 0 1 6 5 4 3 0 3 2 0 3 2 4 2 3 0 2 6 7 8 6 8 6-1 7-1 8 6-1 8-1 1 4 0 4 2 1 6 4 0 0 6 5 5 4 0 2 1 0 3 1 5 1 3 0 1 R R T T T T

  24. Theorem 3.2.11 3. It terminates only when the equality subgraph has a perfect matching.  equal value for the current matching and cover. 4. We need to show Algorithm 3.2.9 always terminate. 5. It suffices to show at each iteration the cost of the cover is reduced at least ε because the cost starts at some value and is bounded below by the weight of a perfect matching.

  25. Theorem 3.2.11 M is not a perfect matching.  |Q|=|M|<|X|.  |R|+|T|<|X-R|+|R|.  |T|<|X-R|. -ε X-R R X Y T +ε

More Related