Guided Lesson Notes
Understanding Breadth-First Search
Breadth-First Search focuses on relationships, reachability, paths, cycles, connectivity, and optimization over edges. Breadth-first search explores level by level using a queue and naturally finds shortest paths in unweighted graphs.
Model: draw vertices as dots and edges as connections; then decide whether direction, weight, or capacity matters.
Invariant: visited, distance, parent, component, or flow arrays must match what has actually been discovered so far.
Implementation: adjacency lists or matrices, queues, stacks, priority queues, union-find, and repeated edge relaxation.
Use Breadth-First Search when the problem mentions roads, networks, prerequisites, components, shortest paths, spanning costs, or dependency order.
