~/ learn/ comp-372/ cards/ Graph algorithms: the decision guide + worked problems
1 of 5

Type RELAX — the single primitive of all shortest-path algorithms

Type RELAX — the single primitive of all shortest-path algorithms

Answer

if dist[v] > dist[u] + w: dist[v] = dist[u] + w pred[v] = u

Bellman-Ford runs this over every edge |V|−1 times then one detection pass; Dijkstra runs it on edges leaving the extracted-min vertex; DAG-shortest-paths runs it in topological order. The schedule differs; the primitive does not.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/7fcd80fc-f820-47ce-85a1-c27b9665f9a2/flashcard utf-8 LF