Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Suurballe's algorithm

Also known as Shortest pair of disjoint paths

search multiobjective-search

Suurballe's algorithm finds two disjoint paths between the same two states with the smallest total cost. Disjoint means that the paths share no edge, or, in the state variant, no state except the two ends. A first Dijkstra run gives distances d and a shortest path P1. Each edge then gets the reduced cost d(u) + c − d(v), which is never negative, and the edges of P1 are reversed with zero cost; a second Dijkstra run gives P2. The edges that P2 uses backwards are removed from P1 ∪ P2, and the rest forms the optimal pair.

Pseudocode

algorithm Suurballe(G, s, t)input: graph G with non-negative edge costs c, start s, target toutput: two edge-disjoint s–t paths of least total cost, or failured, P₁ ← dijkstra(G, s, t)if P₁ = nil thenreturn failureG′ ← empty graphfor each edge (u, v) of G doif (u, v) ∈ P₁ thenadd (v, u) to G′ with cost 0        ▷ reversed copyelseadd (u, v) to G′ with cost d(u) + c(u, v) − d(v)   ▷ reduced cost, ≥ 0P₂ ← shortest s–t path in G′ by dijkstraif P₂ = nil thenreturn failureE ← (edges of P₁ ∪ edges of P₂) ∖ {edges of P₁ that P₂ crosses backwards}return the two s–t paths that E decomposes into

In the crates

Lineage

Comes from

builds on Dijkstra's algorithm

Led to

Nothing on this site.

Papers

  1. Disjoint paths in a network J. W. Suurballe · 1974· Networks introduces doi 10.1002/net.3230040204
  2. A quick method for finding shortest pairs of disjoint paths J. W. Suurballe, R. E. Tarjan · 1984· Networks extends doi 10.1002/net.3230140209