Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Bidirectional Dijkstra

Also known as BiDij

search heuristic-searchminiplan

Bidirectional Dijkstra runs Dijkstra's algorithm forwards from the start and backwards from the goals at the same time. Each step expands the side whose cheapest open state has the smaller g, the cost from that side's origin. A state that both sides reached gives a path, and the cheapest such path costs μ. The search stops when g_min_F + g_min_B ≥ μ; then μ is optimal for non-negative edge costs. It needs no heuristic, only the predecessors of each state, and it is the baseline for bidirectional heuristic search.

Pseudocode

algorithm Bidirectional Dijkstra(s₀, GOALS)input: start s₀, a set of goal states GOALS, non-negative edge costsoutput: a cheapest path from s₀ to a goal, or failuregF[s₀] ← 0OPEN-F ← {s₀}                                ▷ ordered by gF; unseen g are ∞gB[t] ← 0 for each t in GOALSOPEN-B ← GOALS                               ▷ ordered by gBμ ← ∞                                        ▷ cost of the cheapest meetwhile OPEN-F ≠ ∅ and OPEN-B ≠ ∅ doif min-g(OPEN-F) + min-g(OPEN-B) ≥ μ thenbreakif min-g(OPEN-F) ≤ min-g(OPEN-B) thenexpand(OPEN-F, successors, gF, gB)elseexpand(OPEN-B, predecessors, gB, gF)if μ = ∞ thenreturn failurereturn join(path from s₀ to m, path from m to a goal)procedure expand(OPEN, next, g, g-other)s ← extract-min(OPEN)for each (s′, c) in next(s) doif g[s] + c < g[s′] theng[s′] ← g[s] + cparent[s′] ← sinsert-or-update(OPEN, s′, g[s′])if g[s′] + g-other[s′] < μ thenμ ← g[s′] + g-other[s′]m ← s′                                 ▷ the meeting state

In the crates

Lineage

Comes from

builds on Dijkstra's algorithm

Led to

Nothing on this site.