Created
February 7, 2017 10:05
-
-
Save anonymous/a7ca96ff5b0a2d6e8f6f3a7992901d8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BFS(source, goal): | |
queue = empty new queue | |
queue.add(source) | |
if current == goal: | |
return path | |
if current in visited: | |
continue | |
visited.add(current) | |
for direction, neighbour in graph[current]: | |
queue.append((path + direction, neighbour)) | |
return "NO WAY!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment