Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Dijkstra's algorithm

Also known as Dijkstra, Uniform-cost search, UCS

search heuristic-searchdecoupled-search

Dijkstra's algorithm finds cheapest paths from a start state when every step has a non-negative cost. It always expands the open state with the lowest cost from the start, g, so each state is expanded first along its cheapest path. It uses no estimate of the remaining cost; A* adds one.

See it run

1/102

The start state is the only open state.

Dijkstra's algorithm on a small example.Open states are expanded cheapest-first by their cost from the start, g. openclosedexpandingpathwallcostly cell

Pseudocode

algorithm Dijkstra(s₀, goal)input: start state s₀, goal test goaloutput: a cheapest path to a goal state, or failureg[s₀] ← 0OPEN ← {s₀}                                  ▷ ordered by gwhile OPEN ≠ ∅ dos ← extract-min(OPEN)if goal(s) thenreturn path-to(s)for each (s′, c) in successors(s) doif g[s] + c < g[s′] then                 ▷ g of an unseen state is ∞g[s′] ← g[s] + cparent[s′] ← sinsert-or-update(OPEN, s′, g[s′])return failure

In the crates

Lineage

Comes from

Nothing on this site.

Led to

A* generalizes it

Bidirectional Dijkstra builds on it

Ideal-point heuristic builds on it

Morris 2014 backpropagation builds on it

Pattern database builds on it

RUL⁻ builds on it

Sleeve routing combines it

Suurballe's algorithm builds on it

Symbolic Dijkstra builds on it

Papers

  1. A note on two problems in connexion with graphs Edsger W. Dijkstra · 1959· Numerische Mathematik introduces doi 10.1007/BF01386390