Skip to content

Commit 00810e7

Browse files
committed
fix #4
1 parent da7b505 commit 00810e7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

code/Graphs/flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def dfs(self, s, t, FLOW):
1111
if s == t: return FLOW
1212
self.V.add(s)
1313
for u, w in self.G[s].items():
14-
if w and u not in self.dead:
14+
if w:
1515
F = self.dfs(u, t, min(FLOW, w))
1616
if F:
1717
self.G[s][u] -= F
@@ -22,9 +22,9 @@ def dfs(self, s, t, FLOW):
2222

2323
def max_flow(self, s, t):
2424
flow = 0
25-
self.dead = set()
2625
while True:
27-
pushed = self.bfs(s, t)
26+
self.V = set()
27+
pushed = self.dfs(s, t, float('inf'))
2828
if not pushed: break
2929
flow += pushed
3030
return flow

notebook.pdf

12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)