Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/breadth_search.py Secret

Created Feb 17, 2021
Embed
What would you like to do?
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