Loading topic
collections.deque is 5 min readset and dict membership tests work, and have seen the basic BFS loop from the previous chapter: pop a vertex from the front of a deque, then push its neighbors onto the back. Here the focus is one line of that loop, the line that marks a verte5 min readdeque and a visited set, that you know Big-O notation, and that you can read Python dictionaries of adjacency lists. The aim is to show exactly where the work in BFS goes, so the O(V + E) bound becomes something you can check line by l6 min readcollections.deque works. It also helps to know what Dijkstra's algorithm does, though you won't need its details.5 min readdeque and a visited set, why BFS layers give unweighted shortest paths, and why BFS runs in O(V + E) time. It also assumes you have seen depth-first search (DFS) at least briefly. DFS is the traversal 6 min read