-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Fixes #12857 Use collections.deque
as queue
in graphs BFS shortest path - breadth_first_search_shortest_path_2.py
#12861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Why make the proposed change? |
Thank you for the quick review. Yes,
A sample run result of the above code:
|
from collections import deque def breadth_first_search(graph, start, target):
|
Thanks for the input. It should be a separate pull request to modify the algorithm logic. |
Why not https://docs.python.org/3/library/queue.html ? Why not a single file with three implementations -- the original implementation + queue + dequeue -- with a |
Thanks for sharing the doc. The The
|
Describe your change:
Use
collections.deque
asqueue
in graphs BFS shortest path -breadth_first_search_shortest_path_2.py
Checklist: