mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 10:31:29 +08:00
Travis CI: Add a flake8 test for unused imports (#1038)
This commit is contained in:
@ -16,10 +16,19 @@ while Q is non-empty:
|
||||
|
||||
"""
|
||||
|
||||
import collections
|
||||
G = {'A': ['B', 'C'],
|
||||
'B': ['A', 'D', 'E'],
|
||||
'C': ['A', 'F'],
|
||||
'D': ['B'],
|
||||
'E': ['B', 'F'],
|
||||
'F': ['C', 'E']}
|
||||
|
||||
|
||||
def bfs(graph, start):
|
||||
"""
|
||||
>>> ''.join(sorted(bfs(G, 'A')))
|
||||
'ABCDEF'
|
||||
"""
|
||||
explored, queue = set(), [start] # collections.deque([start])
|
||||
explored.add(start)
|
||||
while queue:
|
||||
@ -31,11 +40,5 @@ def bfs(graph, start):
|
||||
return explored
|
||||
|
||||
|
||||
G = {'A': ['B', 'C'],
|
||||
'B': ['A', 'D', 'E'],
|
||||
'C': ['A', 'F'],
|
||||
'D': ['B'],
|
||||
'E': ['B', 'F'],
|
||||
'F': ['C', 'E']}
|
||||
|
||||
print(bfs(G, 'A'))
|
||||
if __name__ == '__main__':
|
||||
print(bfs(G, 'A'))
|
||||
|
Reference in New Issue
Block a user