LESSON 3.11 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Shortest paths: Dijkstra and A*
Watch Dijkstra spread out from F, then watch A* aim at D.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 3.11 · PATH BAYFEWEST-EDGE ROUTE · 3 EDGES · COST 7
01
Stage 1 of 6 · Weighted graph
Each edge of the weighted graph has a weight, its cost. The fewest-edge route costs 7.
Explain it simply
You see 12 nodes joined by 16 edges; the grey bar is a wall. You want the cheapest route from F, the start, to D, the goal. Each edge has a weight, like minutes of travel. The fewest-edge route crosses F–G, with weight 5, so it costs 7.
A 4 by 3 grid of 12 nodes, A to L, with 16 edges. F is the start and D is the goal. The fewest-edge route F, G, H, D costs 7.
not reachedwaiting or popped node, gedge weight, guess hpath and its costlowered g, extra work or costwall
Toy: 4 × 3 grid · 12 nodes · start F · goal D
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
A path's cost is the sum of the weights of its edges.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.