Skip to content

Commit f35a8d1

Browse files
authored
Add missing argument
1 parent 3862f2f commit f35a8d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

max-flow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def min_cost_max_flow(s, t):
341341
return None
342342
build_network()
343343
result_flow = edmonds_karp(s, t)
344-
remove_cycles()
344+
remove_cycles(s)
345345
result_cost = flow_cost()
346346
return result_flow, result_cost
347347
```
@@ -357,14 +357,14 @@ def flow_cost():
357357
Теперь перейдем к функции `remove_cycles`. В ней мы будем в цикле искать отрицательные циклы, пропускать по ним поток, устраняя их и тем самым уменьшая стоимость потока. Как только отрицательный цикл не найден, алгоритм можно завершать.
358358

359359
```python
360-
def remove_cycles():
360+
def remove_cycles(s):
361361

362362
while True:
363363
for v in range(n):
364364
pred[v] = None
365365
dist[v] = None
366366

367-
v = find_cycle()
367+
v = find_cycle(s)
368368
if v is None:
369369
break
370370

0 commit comments

Comments
 (0)