25
правок
Изменения
м
'''if''' (flow == 0) '''return''' 0 '''if''' (<tex>v</tex> == <tex>t</tex>) '''return''' flow '''for''' (<tex>u</tex> = ptr[<tex>v</tex>] '''to''' n) <font color=darkgreen> // u - ссылочный тип</font> '''if''' (<tex>vu \in E</tex>) pushed = dfs(<tex>u</tex>, min(flow, c(<tex>vu</tex>) - f(<tex>vu</tex>))); f(<tex>vu</tex>) += pushed f(<tex>uv</tex>) -= pushed '''return''' pushed '''return''' 0
'''do''' pushed = '''dfs''' (<tex>s</tex>, <tex>\infty</tex>) flow += pushed; '''while''' (pushed > 0)
отступы в псевдокоде
'''int''' dfs('''int''' <tex>v</tex>, '''int''' flow)
'''main'''( )
'''for''' ('''int''' i = 0 '''to''' n)
ptr[i] = 0;