| Conditions | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from abc import ABCMeta, abstractmethod |
||
| 60 | def __init__(self, G, s): |
||
| 61 | if isinstance(G, EdgeWeightedGraph): |
||
| 62 | G = G.to_graph() |
||
| 63 | self.s = s |
||
| 64 | vertex_count = G.vertex_count() |
||
| 65 | self.marked = [False] * vertex_count |
||
| 66 | self.edgeTo = [-1] * vertex_count |
||
| 67 | |||
| 68 | queue = Queue.create() |
||
| 69 | |||
| 70 | queue.enqueue(s) |
||
| 71 | while not queue.is_empty(): |
||
| 72 | v = queue.dequeue() |
||
| 73 | self.marked[v] = True |
||
| 74 | for w in G.adj(v): |
||
| 75 | if not self.marked[w]: |
||
| 76 | self.edgeTo[w] = v |
||
| 77 | queue.enqueue(w) |
||
| 78 | |||
| 89 | return path.iterate() |