Perfect Matching
Abstract
This is pseudocode for Perfect Matching in Bipartite Graphs, adapted from the paperback edition of A Gentle Introduction to Optimization, B. Guerin et al. This is used as a subroutine to find any perfect matching on a subgraph of the larger bipartite graph in the Hungarian Algorithm, whose goal is to find a minimum weight perfect matching.
The operator is essentially an exclusive OR (XOR) of the two sets:
(1) |
Executed on an alternating paths of links included in versus excluded from the set and a second path including at leaast part of that first set, it has the behavior of flipping the ones included versus excluded.
I believe this algorithm as stated assumes that the input graph is connected.
.4
{ } \SetAlgoNoEnd\SetAlgoNoLine
InputInput\SetKwInOutOutputOutput
\InputBipartite graph with bipartition , where
\OutputA perfect matching , or a deficient set .
) where is any -exposed vertex
\While(1)
\uIf where and
\uIf is -exposed
\lIf is a perfect matchingstop
where is any -exposed vertex.
\Else
Let where
\Else
stop is a deficient set