How To Teach Dijkstra’s Algorithm Fast
Teach dijkstras algorithm by building it live on one small map, then scaling to a second example.
The twist: it’s not “mathy magic,” it’s a repeatable set of choices you can watch happen step-by-step.
- A drawn graph (paper/whiteboard) with 6–8 nodes and weighted edges
- A table of distances + “visited” set filling in live
- Color/highlight the current node and the edge relaxations each step
- A second mini-graph that exposes the common failure mode (negative weight)
- Quick screen recording of the same graph in a tool (optional) to verify the final path
Viewers can run dijkstras algorithm by hand on any small graph and know exactly why each step happens.
AUDIT
1) Do you have ONE tiny graph you can solve in under 5 minutes on camera?
2) Can your viewer see the algorithm’s state at all times (distances table + visited set)?
3) Do you have a “why it works” moment that’s visual (the next node is always the smallest unvisited distance)?
FIX
3-step checklist (apply today):
1) Pick the proof graph
- Use 6–8 nodes, 10–12 edges, non-negative weights.
- Pre-calc the final shortest path so you can sanity-check mid-record.
2) Build the visual system
- Distances row: initialize start=0, others=∞.
- Visited set box: add one node per step.
- Rule card on screen: “Pick smallest unvisited distance → relax neighbors → mark visited.”
3) Add one contrast beat
- Show a 10-second “don’t do this” with a negative edge and say: “This is why dijkstras algorithm assumes non-negative weights.”
Hook template (fill-in):
"If you can follow three moves, you can run dijkstras algorithm on this graph: pick the smallest, relax the edges, repeat—watch."
Thumbnail test idea:
A/B test: (A) Big handwritten "0, ∞, ∞" + arrow “Step 1” vs (B) Highlighted shortest path line with text “Why This Path Wins”.
TEST
Film a 6–8 minute whiteboard/desk video.
Open with the hook line verbatim.
Draw the graph in-frame; keep the distances table visible the entire time.
Speak only in steps: pick → relax → visited; update the table every time.
At minute ~4, reveal the final shortest path and trace it in a new color.
End by giving viewers a 20-second practice prompt: “Pause and solve this second graph; answer in comments.”
