A graph nobody draws.
transcript
A panel has three lamps. Each button flips some lamps. Find the fewest presses to switch all off.
Every pattern of lamps is a state. Three lamps give eight states. Each state is a node.
Two lamps give four states. A press leads to another state. So each press is an edge.
The graph has no list. A state computes its neighbours. It flips lamps with an XOR. The whole graph never sits in memory.
BFS starts from the panel's state. Each press reaches a new state. State zero means all lamps off.
A code lock works the same way. Turning one wheel reaches a neighbour. A word ladder changes one letter. Each word is a node.
Without a visited table, every press looks new. The queue would grow without end. Mark each state as it joins.
States are nodes, and moves are edges. Same search, different neighbours. Full breakdown in the lecture.