Minimum Cost Perfect Matching

Abstract

This is pseudocode for Minimum Cost Perfect Matching in Bipartite Graphs

\SetAlgoCaptionSeparator

.3

{algorithm}

Minimum Cost Perfect Matching in Bipartite Graphs

\AlgoDisplayBlockMarkers\AlgoDisplayGroupMarkers\SetAlgoBlockMarkers

{ } \SetAlgoNoEnd\SetAlgoNoLine

\SetKwInOut

InputInput\SetKwInOutOutputOutput \InputGraph G = (V,E) with bipartition U,W where |U| = |W| and costs c. \OutputA minimum cost perfect matching M or a deficient set S

yv→:=12⁢m⁢i⁢n⁢{ce:e∈E} (1)

for all v ∈ V B
\WhileConstruct graph H with vertices V and edges

{u⁢v∈E:cu⁢v=yu→+yv→} (2)
\uIf

H has perfect matching M stop (M is a minimum cost perfect matching of G) Let S ⊆ U be a deficient set for H B
\uIfall edges of G with an endpoint in S have an endpoint in NH(S) stop (S is a deficient set of G)

∈:=min{cu⁢v-yu→-yv→:uv∈E,u∈S,v∉NH(S)} (3)
yv→:={yv→+∈ for ⁢v∈Syv→-∈ for ⁢v∈NH⁢(S)yv→ (4)