Content deleted Content added
m v2.03b - Bot T20 CW#61 - WP:WCW project (Reference before punctuation) |
m Format code |
||
Line 68:
INPUT: Graph ''G'', initial matching ''M'' on ''G''
OUTPUT: maximum matching ''M*'' on ''G''
A1 '''function''' ''find_maximum_matching''(
A2 ''P'' ← ''find_augmenting_path''(
A3 '''if''' ''P'' is non-empty '''then'''
A4
A5 '''else'''
A6
A7 '''end if'''
A8 '''end function'''
Line 119:
INPUT: Graph ''G'', matching ''M'' on ''G''
OUTPUT: augmenting path ''P'' in ''G'' or empty path if none found
B01 '''function''' ''find_augmenting_path''(
B02 ''F'' ← empty forest
B03 unmark all vertices and edges in ''G'', mark all edges of ''M''
Line 125:
B06 create a singleton tree { ''v'' } and add the tree to ''F''
B07 '''end for'''
B08 '''while''' there is an unmarked vertex ''v'' in ''F'' with ''distance(
B09 '''while''' there exists an unmarked edge ''e'' = { ''v'', ''w'' } '''do'''
B10 '''if''' ''w'' is not in ''F'' '''then'''
Line 132:
B12 add edges { ''v'', ''w'' } and { ''w'', ''x'' } to the tree of ''v''
B13 '''else'''
B14 '''if''' ''distance(
// Do nothing.
B15 '''else'''
B16 '''if''' ''root(
// Report an augmenting path in F <math>\cup</math> { ''e'' }.
B17 ''P'' ← path (
B18 '''return''' ''P''
B19 '''else'''
Line 143:
B20 ''B'' ← blossom formed by ''e'' and edges on the path ''v'' → ''w'' in ''T''
B21 ''G’, M’'' ← contract ''G'' and ''M'' by ''B''
B22 ''P’'' ← ''find_augmenting_path''(
B23 ''P'' ← lift ''P’'' to ''G''
B24 '''return''' ''P''
|