AdvancedAbout 30 min

    Dijkstra's Algorithm

    Read the full article on Substack

    6 min read.

    A popular algorithm for finding the shortest path between nodes in a graph. It handles weighted edges and guarantees the shortest path for non-negative weights.

    ~5~5~5~5~5~5~5~5~5~5~5~5~5S~5~5~5~5~5G~5~5~5~5~5~5~5~5~5~5~5~5~5

    Start at (4,1), goal (4,11).

    1/223

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Settle the closest node

    Sequence

    Order one iteration of Dijkstra’s algorithm with a priority queue.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    5. 5Drop a step here
    5 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    What happens if edge weights are negative?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going