Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 17, 2021 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/7c9214ae6da666e645d0ca4385efb9bb to your computer and use it in GitHub Desktop.
Save amankharwal/7c9214ae6da666e645d0ca4385efb9bb to your computer and use it in GitHub Desktop.
if __name__ == '__main__':
graph = dict()
graph['A'] = ['B', 'G', 'D']
graph['B'] = ['A', 'F', 'E']
graph['C'] = ['F', 'H']
graph['D'] = ['F', 'A']
graph['E'] = ['B', 'G']
graph['F'] = ['B', 'D', 'C']
graph['G'] = ['A', 'E']
graph['H'] = ['C']
print(breadth_first(graph, 'A'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment