At the moment, collections.deque is implemented via a linked list of 64-element arrays. That means it can quickly access elements at the beginning and end, and has only a modest amount of space ...
The current implementation of the breadth_first_search_shortest_path_2.py uses a Python list to simulate a queue. However, using a list for this purpose might be ...