Graph Theory37 sections · 1633 units
Open in Course

The Greedy Strategy

Dijkstra's key insight

Edsger W. Dijkstra proposed a simple, "greedy" idea: "Always visit the closest possible node that you have not finished yet." Instead of a simple Queue (First-In-First-Out), you need a generic container that always gives us the smallest item inside it.

If you have two options: Go to BB (Cost 1010) Go to CC (Cost 11) you should process CC first, because it is closer. Maybe CC gives us a shortcut to BB.