Caffeinated Coder
Book an appointment
Lesson 21 · Algorithms

Graph search: BFS and DFS

Maps, friend lists, web links and computer networks are all graphs: things joined to other things. Searching one means visiting every node you can reach, without going round in circles. Step through breadth-first search and depth-first search on the same 7-node graph, watch the queue and the stack that drive them, and see why only one of them finds shortest paths.

12 min12 steps5 questionsIntermediate
Fig 21 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.