Dijkstra's Shortest Path Visualizer

Pseudo-code

function dijkstra(start):
    create distance[] ← ∞
    distance[start] ← 0
    PQ.insert(start, 0)

    while PQ is not empty:
        u ← PQ.extractMin()
        for each neighbor v of u:
            alt ← distance[u] + weight(u, v)
            if alt < distance[v]:
                distance[v] ← alt
                PQ.decreaseKey(v, alt)
        mark u as visited
        record step
        

Priority Queue

    Steps