~/ learn/ comp-372/ cards/ Dijkstra's algorithm
1 of 4

Type the DIJKSTRA pseudocode

Type the DIJKSTRA pseudocode

Answer

DIJKSTRA(G, w, s): INITIALIZE-SINGLE-SOURCE(G, s) S = {} Q = G.V # min-priority queue on d while Q is not empty: u = EXTRACT-MIN(Q) S = S union {u} for each v in G.Adj[u]: RELAX(u, v, w) # DECREASE-KEY if v.d dropped

Each EXTRACT-MIN commits one vertex with its final distance (the squeeze proof, valid only for nonnegative weights). Relaxing its out-edges may improve neighbors still in Q.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/6f46633f-573f-4e1d-a2cd-e2f96f474407/flashcard utf-8 LF