Presentation is loading. Please wait.

Presentation is loading. Please wait.

Maximum Bipartite Matching

Similar presentations


Presentation on theme: "Maximum Bipartite Matching"— Presentation transcript:

1 Maximum Bipartite Matching
In a graph G, if no M-augmenting path exists, then M is a maximum matching in G. In a bipartite graph, we iteratively seek augmenting paths to enlarge the current matching. If we don’t find an augmenting path, we can find a vertex cover with the same size as the current matching, then the current matching has maximum size.

2 Algorithm 3.2.1 Input: An X,Y-bigraph G, a matching M in G, and the set U of M-unsaturated vertices in X. Output: Output an M-augmenting path or a vertex cover of size |M|.

3 Algorithm 3.2.1 Exploring M-alternating paths from U, letting SX and TY be the sets of vertices reached. Marking vertices of S that have been explored for path extensions.

4 Algorithm 3.2.1 (2/2) 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E(G). Mark x and Goto Step 2.

5 Theorem 3.2.2 Repeatedly applying Algorithm to a bipartite graph produces a matching and a vertex cover of equal size 1. Let Q=T(X-S) and M be the matching when algorithm stops at step 2. 2. No edge joins S to Y-T.  Q is a vertex cover. 3. Each yT is M-saturated. 4. Each vertex of X-S is M-saturated. 5. No edge in M joins T to X-S.  M has at least |T|+|X-S| edges.  Q is a minimum vertex cover and M is a maximum matching.

6 Time Complexity of Algorithm 3.2.1
Let G be an X,Y-bigraph with n vertices and m edges. 1. Algorithm executes at most n/2 times since (G)<=n/2. 2. Each execution of Algorithm considers each edge at most once.  The execution time of Algorithm is O(mn).

7 Maximum Weighted Bipartite Matching and Minimum Weighted Cover (Dual Problems)
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. 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.

8 Lemma 3.2.7 For a perfect matching M and weighted cover (u,v) in a weighted bipartite graph G, (1) c(u,v)>=w(M), and (2) c(u,v) =w(M) iff M consists of edges xiyj such that ui+vj=wi,j. In (2), M and (u,v) are optimal. (1) c(u,v)>=w(M) since ui+vj>=wi,j for all i, j. (2) Trivial.

9 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.

10 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 adjusting the cover (u,v) until the equality subgraph Gu,v has a perfect matching. Initialization: Let (u,v) be a cover, such that ui=maxj wi,j and vj=0.

11 Algorithm 3.2.9

12 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 Y. 4. Form the new equality graph and Goto Step 1.

13 Theorem Algorithm finds a maximum weight matching and a minimum cost cover 1. 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. (1) ui’+vj’= ui+vj for edges xiyj from X-R to T or from R to Y-T. (2) ui’+vj’= ui+vj+ε for edges xiyj from R to T. (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}.

14 Theorem 2. It terminates only when the equality subgraph has a perfect matching.  equal value for the current matching and cover. 3. M is not a perfect matching.  |Q|=|M|<|X|.  |R|+|T|<|X-R|+|R|.  |T|<|X-R|.  at each iteration the cost of the cover is reduced at least ε.  algorithm terminates since the cost starts at some value and is bounded below by the weight of a perfect matching.


Download ppt "Maximum Bipartite Matching"

Similar presentations


Ads by Google