Conditions | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from pyalgs.data_structures.commons.queue import Queue |
||
12 | def __init__(self, network, s, t): |
||
13 | self.s = s |
||
14 | self.t = t |
||
15 | self.network = network |
||
16 | self.value = 0.0 |
||
17 | while self.has_augmenting_path(): |
||
18 | x = self.t |
||
19 | bottle = float('inf') |
||
20 | while x != self.s: |
||
21 | bottle = min(bottle, self.edgeTo[x].residual_capacity_to(x)) |
||
22 | x = self.edgeTo[x].other(x) |
||
23 | |||
24 | x = self.t |
||
25 | while x != self.s: |
||
26 | self.edgeTo[x].add_residual_flow_to(x, bottle) |
||
27 | x = self.edgeTo[x].other(x) |
||
28 | |||
29 | self.value += bottle |
||
30 | |||
64 |