
Corresponding max flow problem:

But... there is a much easier algorithm :)

Alternating path 1  Alternating path 2  



Note:


How to increase the matching:

Alternating path  Improved matching 

Alternating path  Improved matching 

Given: Bipartite graph (X,Y) A matching M in (X,Y) for ( each x ∈ X and x is not matched ) { label x by *; // x is current candidate repeat { 1. Apply the oddedge label algorithm: for ( each y ∈ Y and y is not labeled ) if ( some adjacent node x_{k} of y has a label ) label y with x_{k}; 2. Apply the evenedge label algorithm: for ( each x ∈ X and x is not labeled ) if ( some adjacent node y_{k} of x has a label ) label x with y_{k}; } until no more nodes can be labeled /* ====================================== "Breakthrough" test ====================================== */ if ( a node y_{k} ∈ Y is labeled and y ∉ M ) { there is an alternating path from x to y_{k} } else { try next node x (if there are more candidates left) } } 
Note:


Oddedge: use edges ∉ matching  Evenedge: use edges ∈ matching 
Breakthrough test  Alternating path 
Improved matching:
Oddedge: use edges ∉ matching  Evenedge: use edges ∈ matching 
Breakthrough test  Alternating path 
Improved matching:
Oddedge: use edges ∉ matching  Evenedge: use edges ∈ matching  Oddedge: use edges ∉ matching  Evenedge: use edges ∈ matching 
Ends without a breakthrough

Answer to the $64,000 question: