Conditions | 5 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from pyalgs.data_structures.commons.queue import Queue |
||
31 | def has_augmenting_path(self): |
||
32 | vertex_count = self.network.vertex_count() |
||
33 | self.edgeTo = [None] * vertex_count |
||
34 | self.marked = [False] * vertex_count |
||
35 | |||
36 | queue = Queue.create() |
||
37 | |||
38 | queue.enqueue(self.s) |
||
39 | self.marked[self.s] = True |
||
40 | |||
41 | while not queue.is_empty(): |
||
42 | x = queue.dequeue() |
||
43 | for e in self.network.adj(x): |
||
44 | w = e.other(x) |
||
45 | if e.residual_capacity_to(w) > 0: |
||
46 | if not self.marked[w]: |
||
47 | self.marked[w] = True |
||
48 | self.edgeTo[w] = e |
||
49 | queue.enqueue(w) |
||
50 | |||
51 | return self.marked[self.t] |
||
52 | |||
64 |