Skip to main content
. 2021 Jun 26;21(13):4394. doi: 10.3390/s21134394
Algorithm 1. Kuhn–Munkres Algorithm
Β Β Input: A bipartite graph G=(XS,E,XT), corresponding edge weights π“Œ(xSi,xTj)
Β Β Output: the perfect matching M.
  Step 1: Generate initial labeling β„“ and match in Gβ„“
  Step 2: If M perfect, stop. Otherwise, pick a free vertex xSi∈XS. Set S=xSi,Β T=βˆ….
  Step 3: If ℐS(X)=T, update labels (forcing ℐS(X)β‰ T) with following Equations (6) and (7)
Ξ±β„“=mins∈S,yβˆ‰T{𝓫(xSi)+𝓫(xTj)βˆ’π“Œ(xSi,xTj)} (6)
𝓫^={𝓫(x)βˆ’Ξ±β„“,Β Β x∈S𝓫(x)+Ξ±β„“, x∈T𝓫(x), otherwise (7)
  Step 4: If ℐS(X)β‰ T, choose yβˆˆβ„S(X)βˆ’T:
       If y free, π“Šβˆ’π“Ž is augmenting path. Augment M and go to 2
       If y matched, say to 𝓏, extend alternating tree: S=Sβˆͺ 𝓏, T=TβˆͺΒ y. Go to