Module 22 Β· Data Structures & Problem-Solving β Lesson 5 of 7 Β· ~11 min
Graphs: BFS & DFS
Nodes and edges
A graph is nodes connected by edges β more general than a tree (cycles allowed, no single root). The most practical representation for problems is an adjacency map: a hash from each node to the list of its neighbors.
Anchor it in PawWalk: neighborhoods connected by walkable routes. Which neighborhoods can a walker reach on foot from where they are?