SlideShare ist ein Scribd-Unternehmen logo
1 von 70
Downloaden Sie, um offline zu lesen
Bipartite Matching
      郭至軒(KuoE0)
     KuoE0.tw@gmail.com
          KuoE0.ch
Bipartite Graph
                 two disjoint sets




every edge connects between them
Matching
A subset of edges, no two of which share an
                   endpoint.
Valid Matching
           not matching edge
           matching edge




              bachelor
Invalid Matching
            not matching edge
            matching edge




                       shared
Bipartite Matching


     objective: more matching
1         5

          2         6

          3         7

          4         8

not matching edge   9
matching edge
Alternating Path
A path in which the edges belong alternatively to the
         matching and not to the matching.
[1 - 5 - 2 - 9] is an alternating path.

          1                     5

          2                     6

          3                     7

          4                     8

not matching edge               9
matching edge
[1 - 5 - 2 - 9] is an alternating path.

          1                     5

          2                     6

          3                     7

          4                     8

not matching edge               9
matching edge
[1 - 5 - 2 - 6 - 3] is not an alternating path.

           1                     5

           2                     6

           3                     7

           4                     8

not matching edge                9
matching edge
[1 - 5 - 2 - 6 - 3] is not an alternating path.

           1                     5

           2                     6

           3                     7

           4                     8

not matching edge                9
matching edge
Alternating Cycle
A cycle in which the edges belong alternatively to
    the matching and not to the matching.
[1 - 5 - 2 - 9 - 1] is an alternating cycle.

           1                     5

           2                     6

           3                     7

           4                     8

not matching edge                9
matching edge
[1 - 5 - 2 - 9 - 1] is an alternating cycle.

           1                     5

           2                     6

           3                     7

           4                     8

not matching edge                9
matching edge
Reverse the alternating cycle, cardinality won’t change.

                1                    5

                2                    6

                3                    7

                4                    8

     not matching edge               9
     matching edge
Maximum Matching
Augmenting Path Algorithm
Augmenting Path
An alternating path that starts from and ends on
              unmatched vertices.
[2 - 5 - 1 - 9] is an augmenting path.

          1                   5

          2                   6

          3                   7

          4                   8

not matching edge             9
matching edge
[2 - 5 - 1 - 9] is an augmenting path.

          1                   5

          2                   6

          3                   7

          4                   8

not matching edge             9
matching edge
Reverse the augmenting path, cardinality will increase.

                1                    5

                2                    6

                3                    7

                4                    8

     not matching edge               9
     matching edge
Augmenting Path
• The length of an augmenting path
  always is odd.
• Reversing an augmenting path will
  increase the cardinality.
• If there is no augmenting path, the
  cardinality is maximum.
Algorithm
1. Try to build augmenting paths from all
   vertices in one side.
2. Travel on graph.
3. If an augmenting path exists, reverse
   the augmenting path to increase
   cardinality.
4. If no augmenting path exists, ignore
   this vertex.
5. Repeat above step until there no
   augmenting path exists.
[1 - 5] is an augmenting path.

               1                     5

               2                     6

               3                     7

               4                     8

current cardinality: 0
                                     9
    not matching edge
    matching edge
[1 - 5] is an augmenting path.

               1                     5

               2                     6

               3                     7

               4                     8

current cardinality: 0
                                     9
    not matching edge
    matching edge
Reverse it!

               1                   5

               2                   6

               3                   7

               4                   8

current cardinality: 1
                                   9
    not matching edge
    matching edge
[2 - 5 - 1- 9] is an augmenting path.

               1                      5

               2                      6

               3                      7

               4                      8

current cardinality: 1
                                      9
    not matching edge
    matching edge
[2 - 5 - 1- 9] is an augmenting path.

               1                      5

               2                      6

               3                      7

               4                      8

current cardinality: 1
                                      9
    not matching edge
    matching edge
Reverse it!

               1                   5

               2                   6

               3                   7

               4                   8

current cardinality: 2
                                   9
    not matching edge
    matching edge
[3 - 6] is an augmenting path.

               1                     5

               2                     6

               3                     7

               4                     8

current cardinality: 2
                                     9
    not matching edge
    matching edge
[3 - 6] is an augmenting path.

               1                     5

               2                     6

               3                     7

               4                     8

current cardinality: 2
                                     9
    not matching edge
    matching edge
Reverse it!

               1                   5

               2                   6

               3                   7

               4                   8

current cardinality: 3
                                   9
    not matching edge
    matching edge
[4 - 5 - 2 - 6 - 3 - 7] is an augmenting path.

                1                      5

                2                      6

                3                      7

                4                      8

current cardinality: 3
                                       9
    not matching edge
    matching edge
[4 - 5 - 2 - 6 - 3 - 7] is an augmenting path.

                1                      5

                2                      6

                3                      7

                4                      8

current cardinality: 3
                                       9
    not matching edge
    matching edge
Reverse it!

               1                   5

               2                   6

               3                   7

               4                   8

current cardinality: 4
                                   9
    not matching edge
    matching edge
Max cardinality is 4.
          1                  5

          2                  6

          3                  7

          4                  8

                             9
not matching edge
matching edge
Time Complexity
      O(V × E)

  V: number of vertices
  E: number of edges
Source Code
// find an augmenting path
bool find_aug_path( int x ) {
	   for ( int i = 0; i < ( int )vertex[ x ].size(); ++i ) {
	   	   int next = vertex[ x ][ i ];
	   	   // not in augmenting path
	   	   if ( !visit[ next ] ) {
	   	   	   // setup this vertex in augmenting path
	   	   	   visit[ next ] = 1;
	   	   	   /*
	   	   	     * If this vertex is a unmatched vertex, reverse
augmenting path and return.
	   	   	     * If this vector is a matched vertex, try to reverse
augmenting path and continue find an unmatched vertex.
	   	   	     */
	   	   	   if ( lnk2[ next ] == -1 || find_aug_path( lnk2[ next ] ) )
{
	   	   	   	    lnk1[ x ] = next, lnk2[ next ] = x;
	   	   	   	    return 1;
	   	   	   }
	   	   }
	   }
	   return 0;
}
Practice Now
 UVa 670 - The dog task
Maximum Weight Matching
Hungarian Algorithm
         (Kuhn-Munkres Algorithm)
5
1                4
    2   3
            1
2                5

3   5       -2   6
weight adjustment
If add (subtract) some value on all edges connected with
   vertex X, the maximum matching won’t be effected.

      1              4           1              4
             a                         a+d
             b                         b+d
      2              5           2              5
             c                         c+d
      3              6           3              6


          matching edge       not matching edge
vertex labeling
For convenient, add a variable on vertices to denote the
  value add (subtract) on edges connected with them.

      1              4           1              4
             a                         a+d
             b                         b+d
 d    2
             c
                     5    ≡      2
                                       c+d
                                                5

      3              6           3              6


          matching edge       not matching edge
vertex labeling
l(x)+l(y)≥w(x,y), for each edge(x,y)


                  5
   5   1                     4   0
             2    3
                      1
   3   2                     5   0

   5   3     5        -2     6   0
minimize vertex labeling
Admissible Edge: l(x)+l(y)=w(x,y)

                 5
  2    1                   4     3
            2    3
                      1
  0    2                   5     1

  4    3     5        -2   6     0
convert
   maximum weight problem
              to
minimum vertex labeling problem
Augmenting Path with Admissible Edge

                       5
       5   1                        4   0
                 2     3
                              1
       3   2                        5   0

       5   3      5          -2     6   0


[1 - 4] is an augment path with admissible edges.
Augmenting Path with Admissible Edge

                       5
       5   1                        4   0
                 2     3
                              1
       3   2                        5   0

       5   3      5          -2     6   0


[1 - 4] is an augment path with admissible edges.
Augmenting Path with Admissible Edge

                     5
     5   1                        4   0
               2     3
                           1
     3   2                        5   0

     5   3     5          -2      6   0


                 Reverse it!
             Current Weight = 5
Augmenting Path with Admissible Edge

                       5
      5   1                          4   0
                 2     3
                              1
      3   2                          5   0

      5   3      5           -2      6   0


  No augmenting path found start from vertex 2.
Augmenting Path with Admissible Edge

                       5
      5   1                          4   0
                 2     3
                              1
      3   2                          5   0

      5   3      5           -2      6   0


  No augmenting path found start from vertex 2.
Adjust Vertex Labeling

                    5
    5   1                         4   0
              2     3
                           1
   3    2                         5   0

    5   3     5            -2     6   0

relax value d = min(l(x)+l(y)-w(x,y))
    x: vertex in alternating path
    y: vertex y not in alternating path
Adjust Vertex Labeling

                   5
5    1                          4    0
           2       3
                         1
3    2                          5    0

5    3         5         -2     6    0

    R(1,6)=3
    R(2,5)=2           relax d = 2
    R(2,6)=5
Adjust Vertex Labeling

                  5
3   1                            4   2
            2     3
                        1
1   2                            5   0

5   3       5           -2       6   0

        l(x) subtract value d.
        l(y) add value d.
Continue to Find Augmenting Path

                       5
       3   1                        4   2
                 2     3
                              1
       1   2                        5   0

       5   3      5          -2     6   0


[2 - 5] is an augment path with admissible edges.
Continue to Find Augmenting Path

                       5
       3   1                        4   2
                 2     3
                              1
       1   2                        5   0

       5   3      5          -2     6   0


[2 - 5] is an augment path with admissible edges.
Continue to Find Augmenting Path

                   5
   3   1                        4   2
             2     3
                         1
   1   2                        5   0

   5   3     5          -2      6   0


               Reverse it!
           Current Weight = 6
Continue to Find Augmenting Path

                     5
    3   1                          4   2
               2     3
                            1
    1   2                          5   0

    5   3      5           -2      6   0


No augmenting path found start from vertex 3.
Continue to Find Augmenting Path

                     5
    3   1                          4   2
               2     3
                            1
    1   2                          5   0

    5   3      5           -2      6   0


No augmenting path found start from vertex 3.
Adjust Vertex Labeling

                   5
3    1                          4    2
           2       3
                         1
1    2                          5    0

5    3         5         -2     6    0

    R(1,6)=1
                       relax d = 1
    R(2,6)=3
Adjust Vertex Labeling

                  5
2   1                            4   3
            2     3
                        1
0   2                            5   1

4   3       5           -2       6   0

        l(x) subtract value d.
        l(y) add value d.
Continue to Find Augmenting Path

                      5
     2   1                          4   3
                2     3
                             1
     0   2                          5   1

     4   3      5            -2     6   0


[3 - 5 - 2 - 4 - 1 - 6] is an augment path with
               admissible edges.
Continue to Find Augmenting Path

                      5
     2   1                          4   3
                2     3
                             1
     0   2                          5   1

     4   3      5            -2     6   0


[3 - 5 - 2 - 4 - 1 - 6] is an augment path with
               admissible edges.
Continue to Find Augmenting Path

                   5
   2   1                         4   3
              2    3
                         1
   0   2                         5   1

   4   3      5          -2      6   0


                Reverse it!
           Current Weight = 10
Maximum Weight Matching = 10

              5
  2   1                4   3
          2   3
                  1
  0   2                5   1

  4   3   5       -2   6   0
Algorithm
1. Initial vertex labeling to fit l(x)+l(y)≥w(x,y)
2. Find augmenting paths composed with
   admissible edges from all vertices in one side.
3. If no augmenting path exists, adjust vertex
   labeling until the augmenting path found.
4. If augmenting path exists, continue to find next
   augmenting path.
5. Repeat above step until there no augmenting
   path exists.
6. Calculate the sum of weight on matching edges.
Practice Now
POJ 2195 - Going Home
Problem List
     UVa 670
     UVa 753
    UVa 10080
    UVa 10092
    UVa 10243
    UVa 10418
    UVa 10984
    POJ 3565
Reference
•   http://en.wikipedia.org/wiki/Bipartite_graph

•   http://en.wikipedia.org/wiki/Matching_(graph_theory)

•   http://www.flickr.com/photos/marceau_r/5244129689

•   http://www.sanfilippo-chianti.it/offerta-svalentino.html

•   http://www.csie.ntnu.edu.tw/~u91029/Matching.html
Thank You for Your
    Listening.

Weitere ähnliche Inhalte

Was ist angesagt?

Decision tree and instance-based learning for label ranking
Decision tree and instance-based learning for label rankingDecision tree and instance-based learning for label ranking
Decision tree and instance-based learning for label rankingroywwcheng
 
de Bruijn Graph Construction from Combination of Short and Long Reads
de Bruijn Graph Construction from Combination of Short and Long Readsde Bruijn Graph Construction from Combination of Short and Long Reads
de Bruijn Graph Construction from Combination of Short and Long ReadsSikder Tahsin Al-Amin
 
Form 4 formulae and note
Form 4 formulae and noteForm 4 formulae and note
Form 4 formulae and notesmktsj2
 
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPER
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPERCLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPER
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPERRc Os
 
Cuckoo search algorithm
Cuckoo search algorithmCuckoo search algorithm
Cuckoo search algorithmRitesh Kumar
 
Bird species classification based on their sound
Bird species classification based on their sound Bird species classification based on their sound
Bird species classification based on their sound Partha Sarathi Kar
 
Introduction to Optimization with Genetic Algorithm (GA)
Introduction to Optimization with Genetic Algorithm (GA)Introduction to Optimization with Genetic Algorithm (GA)
Introduction to Optimization with Genetic Algorithm (GA)Ahmed Gad
 
Greedy algorithm activity selection fractional
Greedy algorithm activity selection fractionalGreedy algorithm activity selection fractional
Greedy algorithm activity selection fractionalAmit Kumar Rathi
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMPuneet Kulyana
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm pptMayank Jain
 
Decision tree in artificial intelligence
Decision tree in artificial intelligenceDecision tree in artificial intelligence
Decision tree in artificial intelligenceMdAlAmin187
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning AlgorithmsDezyreAcademy
 
Randomized Algorithm- Advanced Algorithm
Randomized Algorithm- Advanced AlgorithmRandomized Algorithm- Advanced Algorithm
Randomized Algorithm- Advanced AlgorithmMahbubur Rahman
 
Telomere-to-telomere assembly of a complete human chromosomes
Telomere-to-telomere assembly of a complete human chromosomesTelomere-to-telomere assembly of a complete human chromosomes
Telomere-to-telomere assembly of a complete human chromosomesGenome Reference Consortium
 
Graph Based Clustering
Graph Based ClusteringGraph Based Clustering
Graph Based ClusteringSSA KPI
 

Was ist angesagt? (20)

Cross-Validation
Cross-ValidationCross-Validation
Cross-Validation
 
Decision tree and instance-based learning for label ranking
Decision tree and instance-based learning for label rankingDecision tree and instance-based learning for label ranking
Decision tree and instance-based learning for label ranking
 
de Bruijn Graph Construction from Combination of Short and Long Reads
de Bruijn Graph Construction from Combination of Short and Long Readsde Bruijn Graph Construction from Combination of Short and Long Reads
de Bruijn Graph Construction from Combination of Short and Long Reads
 
Cluster analysis
Cluster analysisCluster analysis
Cluster analysis
 
Form 4 formulae and note
Form 4 formulae and noteForm 4 formulae and note
Form 4 formulae and note
 
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPER
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPERCLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPER
CLASS VIII MATHS PERIODIC TEST 1 SAMPLE PAPER
 
Cuckoo search algorithm
Cuckoo search algorithmCuckoo search algorithm
Cuckoo search algorithm
 
Bird species classification based on their sound
Bird species classification based on their sound Bird species classification based on their sound
Bird species classification based on their sound
 
Introduction to Optimization with Genetic Algorithm (GA)
Introduction to Optimization with Genetic Algorithm (GA)Introduction to Optimization with Genetic Algorithm (GA)
Introduction to Optimization with Genetic Algorithm (GA)
 
Greedy algorithm activity selection fractional
Greedy algorithm activity selection fractionalGreedy algorithm activity selection fractional
Greedy algorithm activity selection fractional
 
Modul 1: Algebra
Modul 1: AlgebraModul 1: Algebra
Modul 1: Algebra
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHM
 
Genetic algorithm ppt
Genetic algorithm pptGenetic algorithm ppt
Genetic algorithm ppt
 
Decision tree in artificial intelligence
Decision tree in artificial intelligenceDecision tree in artificial intelligence
Decision tree in artificial intelligence
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
Sudokureport
SudokureportSudokureport
Sudokureport
 
Randomized Algorithm- Advanced Algorithm
Randomized Algorithm- Advanced AlgorithmRandomized Algorithm- Advanced Algorithm
Randomized Algorithm- Advanced Algorithm
 
Telomere-to-telomere assembly of a complete human chromosomes
Telomere-to-telomere assembly of a complete human chromosomesTelomere-to-telomere assembly of a complete human chromosomes
Telomere-to-telomere assembly of a complete human chromosomes
 
Graph Based Clustering
Graph Based ClusteringGraph Based Clustering
Graph Based Clustering
 
Support Vector Machines ( SVM )
Support Vector Machines ( SVM ) Support Vector Machines ( SVM )
Support Vector Machines ( SVM )
 

Andere mochten auch

[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's AlgorithmChih-Hsuan Kuo
 
[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree IsomorphismChih-Hsuan Kuo
 
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...Kostas Katrinis
 
ICPC 2015 - Welcome from the chairs
ICPC 2015 - Welcome from the chairsICPC 2015 - Welcome from the chairs
ICPC 2015 - Welcome from the chairsRocco Oliveto
 
[ACM-ICPC] Minimum Cut
[ACM-ICPC] Minimum Cut[ACM-ICPC] Minimum Cut
[ACM-ICPC] Minimum CutChih-Hsuan Kuo
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in RustChih-Hsuan Kuo
 
Graph terminologies & special type graphs
Graph terminologies & special type graphsGraph terminologies & special type graphs
Graph terminologies & special type graphsNabeel Ahsen
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comHemant Gautam
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...ertekg
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy AlgorithmWaqar Akram
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 

Andere mochten auch (20)

[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm
 
[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism
 
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...
Teaching Graph Algorithms in the Field - Bipartite Matching in optical datace...
 
[ACM-ICPC] Traversal
[ACM-ICPC] Traversal[ACM-ICPC] Traversal
[ACM-ICPC] Traversal
 
ICPC 2015 - Welcome from the chairs
ICPC 2015 - Welcome from the chairsICPC 2015 - Welcome from the chairs
ICPC 2015 - Welcome from the chairs
 
[ACM-ICPC] Minimum Cut
[ACM-ICPC] Minimum Cut[ACM-ICPC] Minimum Cut
[ACM-ICPC] Minimum Cut
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
 
Graphs
GraphsGraphs
Graphs
 
Graph terminologies & special type graphs
Graph terminologies & special type graphsGraph terminologies & special type graphs
Graph terminologies & special type graphs
 
Knapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.comKnapsack Algorithm www.geekssay.com
Knapsack Algorithm www.geekssay.com
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...
 
Knapsack problem
Knapsack problemKnapsack problem
Knapsack problem
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
Greedy
GreedyGreedy
Greedy
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Knapsack
KnapsackKnapsack
Knapsack
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 

Mehr von Chih-Hsuan Kuo

[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-selectChih-Hsuan Kuo
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。Chih-Hsuan Kuo
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Chih-Hsuan Kuo
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoChih-Hsuan Kuo
 
Pocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OSPocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OSChih-Hsuan Kuo
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in GeckoChih-Hsuan Kuo
 
面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!Chih-Hsuan Kuo
 
Windows 真的不好用...
Windows 真的不好用...Windows 真的不好用...
Windows 真的不好用...Chih-Hsuan Kuo
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint SetChih-Hsuan Kuo
 
[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient AlgorithmChih-Hsuan Kuo
 
[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-upChih-Hsuan Kuo
 

Mehr von Chih-Hsuan Kuo (20)

Rust
RustRust
Rust
 
[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-select
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in Gecko
 
Pocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OSPocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OS
 
Necko walkthrough
Necko walkthroughNecko walkthrough
Necko walkthrough
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
 
面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!
 
應徵軟體工程師
應徵軟體工程師應徵軟體工程師
應徵軟體工程師
 
面試心得分享
面試心得分享面試心得分享
面試心得分享
 
Windows 真的不好用...
Windows 真的不好用...Windows 真的不好用...
Windows 真的不好用...
 
Python @Wheel Lab
Python @Wheel LabPython @Wheel Lab
Python @Wheel Lab
 
Introduction to VP8
Introduction to VP8Introduction to VP8
Introduction to VP8
 
Python @NCKU CSIE
Python @NCKU CSIEPython @NCKU CSIE
Python @NCKU CSIE
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set
 
[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245
 
[ACM-ICPC] Sort
[ACM-ICPC] Sort[ACM-ICPC] Sort
[ACM-ICPC] Sort
 
[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm
 
[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up
 

Kürzlich hochgeladen

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 

Kürzlich hochgeladen (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

[ACM-ICPC] Bipartite Matching

  • 1. Bipartite Matching 郭至軒(KuoE0) KuoE0.tw@gmail.com KuoE0.ch
  • 2. Bipartite Graph two disjoint sets every edge connects between them
  • 3. Matching A subset of edges, no two of which share an endpoint.
  • 4. Valid Matching not matching edge matching edge bachelor
  • 5. Invalid Matching not matching edge matching edge shared
  • 6. Bipartite Matching objective: more matching
  • 7. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 8. Alternating Path A path in which the edges belong alternatively to the matching and not to the matching.
  • 9. [1 - 5 - 2 - 9] is an alternating path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 10. [1 - 5 - 2 - 9] is an alternating path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 11. [1 - 5 - 2 - 6 - 3] is not an alternating path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 12. [1 - 5 - 2 - 6 - 3] is not an alternating path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 13. Alternating Cycle A cycle in which the edges belong alternatively to the matching and not to the matching.
  • 14. [1 - 5 - 2 - 9 - 1] is an alternating cycle. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 15. [1 - 5 - 2 - 9 - 1] is an alternating cycle. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 16. Reverse the alternating cycle, cardinality won’t change. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 18. Augmenting Path An alternating path that starts from and ends on unmatched vertices.
  • 19. [2 - 5 - 1 - 9] is an augmenting path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 20. [2 - 5 - 1 - 9] is an augmenting path. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 21. Reverse the augmenting path, cardinality will increase. 1 5 2 6 3 7 4 8 not matching edge 9 matching edge
  • 22. Augmenting Path • The length of an augmenting path always is odd. • Reversing an augmenting path will increase the cardinality. • If there is no augmenting path, the cardinality is maximum.
  • 23. Algorithm 1. Try to build augmenting paths from all vertices in one side. 2. Travel on graph. 3. If an augmenting path exists, reverse the augmenting path to increase cardinality. 4. If no augmenting path exists, ignore this vertex. 5. Repeat above step until there no augmenting path exists.
  • 24. [1 - 5] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 0 9 not matching edge matching edge
  • 25. [1 - 5] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 0 9 not matching edge matching edge
  • 26. Reverse it! 1 5 2 6 3 7 4 8 current cardinality: 1 9 not matching edge matching edge
  • 27. [2 - 5 - 1- 9] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 1 9 not matching edge matching edge
  • 28. [2 - 5 - 1- 9] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 1 9 not matching edge matching edge
  • 29. Reverse it! 1 5 2 6 3 7 4 8 current cardinality: 2 9 not matching edge matching edge
  • 30. [3 - 6] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 2 9 not matching edge matching edge
  • 31. [3 - 6] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 2 9 not matching edge matching edge
  • 32. Reverse it! 1 5 2 6 3 7 4 8 current cardinality: 3 9 not matching edge matching edge
  • 33. [4 - 5 - 2 - 6 - 3 - 7] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 3 9 not matching edge matching edge
  • 34. [4 - 5 - 2 - 6 - 3 - 7] is an augmenting path. 1 5 2 6 3 7 4 8 current cardinality: 3 9 not matching edge matching edge
  • 35. Reverse it! 1 5 2 6 3 7 4 8 current cardinality: 4 9 not matching edge matching edge
  • 36. Max cardinality is 4. 1 5 2 6 3 7 4 8 9 not matching edge matching edge
  • 37. Time Complexity O(V × E) V: number of vertices E: number of edges
  • 38. Source Code // find an augmenting path bool find_aug_path( int x ) { for ( int i = 0; i < ( int )vertex[ x ].size(); ++i ) { int next = vertex[ x ][ i ]; // not in augmenting path if ( !visit[ next ] ) { // setup this vertex in augmenting path visit[ next ] = 1; /* * If this vertex is a unmatched vertex, reverse augmenting path and return. * If this vector is a matched vertex, try to reverse augmenting path and continue find an unmatched vertex. */ if ( lnk2[ next ] == -1 || find_aug_path( lnk2[ next ] ) ) { lnk1[ x ] = next, lnk2[ next ] = x; return 1; } } } return 0; }
  • 39. Practice Now UVa 670 - The dog task
  • 40. Maximum Weight Matching Hungarian Algorithm (Kuhn-Munkres Algorithm)
  • 41. 5 1 4 2 3 1 2 5 3 5 -2 6
  • 42. weight adjustment If add (subtract) some value on all edges connected with vertex X, the maximum matching won’t be effected. 1 4 1 4 a a+d b b+d 2 5 2 5 c c+d 3 6 3 6 matching edge not matching edge
  • 43. vertex labeling For convenient, add a variable on vertices to denote the value add (subtract) on edges connected with them. 1 4 1 4 a a+d b b+d d 2 c 5 ≡ 2 c+d 5 3 6 3 6 matching edge not matching edge
  • 44. vertex labeling l(x)+l(y)≥w(x,y), for each edge(x,y) 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0
  • 45. minimize vertex labeling Admissible Edge: l(x)+l(y)=w(x,y) 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0
  • 46. convert maximum weight problem to minimum vertex labeling problem
  • 47. Augmenting Path with Admissible Edge 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 [1 - 4] is an augment path with admissible edges.
  • 48. Augmenting Path with Admissible Edge 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 [1 - 4] is an augment path with admissible edges.
  • 49. Augmenting Path with Admissible Edge 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 Reverse it! Current Weight = 5
  • 50. Augmenting Path with Admissible Edge 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 No augmenting path found start from vertex 2.
  • 51. Augmenting Path with Admissible Edge 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 No augmenting path found start from vertex 2.
  • 52. Adjust Vertex Labeling 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 relax value d = min(l(x)+l(y)-w(x,y)) x: vertex in alternating path y: vertex y not in alternating path
  • 53. Adjust Vertex Labeling 5 5 1 4 0 2 3 1 3 2 5 0 5 3 5 -2 6 0 R(1,6)=3 R(2,5)=2 relax d = 2 R(2,6)=5
  • 54. Adjust Vertex Labeling 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 l(x) subtract value d. l(y) add value d.
  • 55. Continue to Find Augmenting Path 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 [2 - 5] is an augment path with admissible edges.
  • 56. Continue to Find Augmenting Path 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 [2 - 5] is an augment path with admissible edges.
  • 57. Continue to Find Augmenting Path 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 Reverse it! Current Weight = 6
  • 58. Continue to Find Augmenting Path 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 No augmenting path found start from vertex 3.
  • 59. Continue to Find Augmenting Path 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 No augmenting path found start from vertex 3.
  • 60. Adjust Vertex Labeling 5 3 1 4 2 2 3 1 1 2 5 0 5 3 5 -2 6 0 R(1,6)=1 relax d = 1 R(2,6)=3
  • 61. Adjust Vertex Labeling 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0 l(x) subtract value d. l(y) add value d.
  • 62. Continue to Find Augmenting Path 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0 [3 - 5 - 2 - 4 - 1 - 6] is an augment path with admissible edges.
  • 63. Continue to Find Augmenting Path 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0 [3 - 5 - 2 - 4 - 1 - 6] is an augment path with admissible edges.
  • 64. Continue to Find Augmenting Path 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0 Reverse it! Current Weight = 10
  • 65. Maximum Weight Matching = 10 5 2 1 4 3 2 3 1 0 2 5 1 4 3 5 -2 6 0
  • 66. Algorithm 1. Initial vertex labeling to fit l(x)+l(y)≥w(x,y) 2. Find augmenting paths composed with admissible edges from all vertices in one side. 3. If no augmenting path exists, adjust vertex labeling until the augmenting path found. 4. If augmenting path exists, continue to find next augmenting path. 5. Repeat above step until there no augmenting path exists. 6. Calculate the sum of weight on matching edges.
  • 67. Practice Now POJ 2195 - Going Home
  • 68. Problem List UVa 670 UVa 753 UVa 10080 UVa 10092 UVa 10243 UVa 10418 UVa 10984 POJ 3565
  • 69. Reference • http://en.wikipedia.org/wiki/Bipartite_graph • http://en.wikipedia.org/wiki/Matching_(graph_theory) • http://www.flickr.com/photos/marceau_r/5244129689 • http://www.sanfilippo-chianti.it/offerta-svalentino.html • http://www.csie.ntnu.edu.tw/~u91029/Matching.html
  • 70. Thank You for Your Listening.