| Conditions | 4 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from abc import ABCMeta, abstractmethod |
||
| 80 | def __init__(self, G): |
||
| 81 | vertex_count = G.vertex_count() |
||
| 82 | self.pq = IndexMinPQ(vertex_count) |
||
| 83 | self.path = Bag() |
||
| 84 | self.marked = [False] * vertex_count |
||
| 85 | |||
| 86 | self.visit(G, 0) |
||
| 87 | |||
| 88 | while not self.pq.is_empty() and self.path.size() < vertex_count - 1: |
||
| 89 | e = self.pq.min_key() |
||
| 90 | w = self.pq.del_min() |
||
| 91 | self.path.add(e) |
||
| 92 | if not self.marked[w]: |
||
| 93 | self.visit(G, w) |
||
| 94 | |||
| 109 |