1 / 23

3.2.1. Augmenting path algorithm

3.2.1. Augmenting path algorithm. Two theorems to recall: Theorem 3.1.10 (Berge). A matching M in a graph G is a maximum matching in G iff G has no M- augmenting path.

imaran
Télécharger la présentation

3.2.1. Augmenting path algorithm

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. 3.2.1. Augmenting path algorithm Two theorems to recall: Theorem 3.1.10 (Berge).A matching M in a graph G is a maximum matching in G iff G has no M-augmenting path. Theorem 3.1.16 (König,Egerváry) If G is bipartite, then a maximum matching and a minimum vertex cover of G have the same size (’(G)=(G)). Augmenting path algorithm for maximum bipartite matching Input: X,Y-bigraph. Output: M,Q with |M|=|Q| Use modified breadth-first search to find augmenting paths. Initialize with empty matching and iteratively increase by 1. Produce a vertex cover of same size to certify the output.

  2. 3.2.1. Augmenting path algorithm Algorithm (Augmenting path algorithm) Input An X,Y-bigraph G, a (partial matching) M, and the set U of M-unsaturated vertices of X Idea Explore augmenting paths to all possible vertices, marking explored vertices and their predecessors, and tracking reached vertices SµX and TµY Initialization S=U and T=; Iteration If S is all marked, stop and output M and Q=T[(X-S). Otherwise, explore from an unmarked x2S. For any edge xy2E(G)-M: (1) mark y and put y in T. (2) For any edge yw2M, mark w and put w in S. Stop if an unsaturated y is found; report an M-augmenting path. Otherwise continue exploring in this fashion.

  3. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 Iteration 1 Input: M=;S=U=X, T=;, x=x1

  4. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T Iteration 1: y1 unsaturated. Halt and augment M.

  5. Augmenting path algorithm example S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 Iteration 2 Input: M={x1y1} S={x2, x3, x4, x5}, T=;, x=x2

  6. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T Iteration 2: From x2, explore y1 and its matched neighbors

  7. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T Iteration 2: From x1, explore y2 and its matched neighbors. y2 is unsaturated: halt and augment M.

  8. Augmenting path algorithm example S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 Iteration 3 Input: M={x1y2, x2y1} S={x3, x4, x5}, T=;, x=x3

  9. Augmenting path algorithm example S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T Iteration 3: From x3, explore y3 and its matched neighbors. y3 unsaturated, so terminate and report augmenting path.

  10. Augmenting path algorithm example S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 Iteration 4 Input: M={x1y2, x2y1, x3y3} S={x4, x5}, T=;, x=x4

  11. Augmenting path algorithm example S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T Iteration 4: From x4, explore y2,y3 and their (distinct) matched neighbors.

  12. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T T Iteration 4: From x1, and x3, explore to find y1 via non-matching edges. Explore back up to x2 via a matching edge.

  13. Augmenting path algorithm example S S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T T T Iteration 4 (continued): x5 is still unexplored. Explore from x5 to find unsaturated vertex y4. Terminate and report an M-augmenting path.

  14. Augmenting path algorithm example S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 Iteration 5 Input: M={x1y2,x2y1,x3y3,x5y4} S={x4}, T=;, x=x4

  15. Augmenting path algorithm example S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T Iteration 5: From x4, explore y2,y3 and their (distinct) matched neighbors.

  16. Augmenting path algorithm example S S S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T T Iteration 5: From x1, and x3, explore to find y1 via non-matching edges. Explore back up to x2 via a matching edge.

  17. Augmenting path algorithm example S S Q S S x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 T T T Q Q Q Termination: No vertex of S is unexplored. Output: maximum matching M={x1y2,x2y1,x3y3,x5y4} Minimum vertex cover Q=T[(X-S) ={x5,y1,y2,y3}.

  18. Maximum Weighted Transversal Transversal: A set M of n entries of an n£n, matrix, no two in the same column or row. Its weight is the sum of the entries. Cover: A pair of vectors (u,v)=(u1,…,un;v1,…,vn) such that every entry wi,j of the matrix satisfies wi,j·ui+vj. v w(u,v)=32 u w(M)=23

  19. 3.2.7. Maximum Transversal = Minimum Cover 3.2.7. Lemma. (Duality of weighted matching and weighted cover problems) For a perfect matching M and a weighted cover (u,v) in a weighted bipartite graph G, c(u,v)¸w(M). Also, c(u,v)=w(M) iff M consists of edges xiyj such that ui+vj=wi,j. In this case, M and (u,v) are optimal. v w(u,v)=12 u w(M)=12

  20. 3.2.9. Hungarian Algorithm (Maximum Weighted Matching/Minimum Weighted Cover) 20 Algorithm (Hungarian Algorithm) Input An n£n matrix of nonnegative edge weights of Kn,n Idea Iteratively adjust the cover (u,v) until the equality subgraph Gu,v has a perfect matching Initialization Any cover (u,v), such as ui=maxiwi,j and vj=0 Iteration Find a maximum matching M in Gu,v. If M is a perfect matching, stop and output M and (u,v) as a maximum weight matching and minimum weight cover. Otherwise: Let  = smallest excess in Gu,v of an edge from X-R to Y-T. Replace uiÃui- for all xi2X-R. Replace vjÃvj+ for all yj2Y-T. Form the new equality subgraph Gu,v and repeat.

  21. Hungarian Algorithm Example excess matrix v v u u  R T T R w(M)=21 w(u,v)=35 x1 x2 x3 x4 x5 Equality subgraph vertex cover: Q=R[T Add =1 to T, subtract from X-R. y1 y2 y3 y4 y5 T T

  22. Hungarian Algorithm Example excess matrix v v u u  T T T w(M)=21 w(u,v)=33 x1 x2 x3 x4 x5 Equality subgraph vertex cover: Q=R[T Add =1 to T, subtract from X-R. y1 y2 y3 y4 y5 T T T

  23. Hungarian Algorithm Example excess matrix v v u u T T T w(M)=31 w(u,v)=31 x1 x2 x3 x4 x5 Matching weight=cover weight. Halt and output M, and (u,v). y1 y2 y3 y4 y5 equality subgraph

More Related