The Held-Karp algorithm is a dynamic programming algorithm for finding a minimum-weight Hamiltonian
cycle, and therefore an exact solution of the traveling
salesman problem. Let the vertices of a complete
weighted graph be 1, 2, ..., , let
be the weight of the graph
edge joining
and
,
and fix vertex 1 as the starting point. For a nonempty
subset
and
, define
to be the minimum weight of a path
that starts at 1, visits precisely the vertices in
,
and ends at
.
For ,
the initial values are
|
(1)
|
For ,
the recurrence relation is
|
(2)
|
The minimum tour length is then
|
(3)
|
Evaluating the subsets in increasing order of size gives
states, each of which examines at most
possible preceding vertices.
The resulting running time is
, and storing the full table and one minimizing predecessor
per state requires
space. Following the predecessors reconstructs a minimum tour.
Bellman (1962) published a closely related dynamic
programming treatment of the traveling
salesman problem.