Algorithm 595: An Enumerative Algorithm for Finding Hamiltonian Circuits in a Directed Graph

Let G = (V, A) be a directed graph (or digraph), where V {vl, v2 . . . . . v ,} is the set of the n ver t ices and A is the set o f the m arcs (v,, vj) in G. A Hamiltonian circuit in G is a p e r m u t a t i o n (s,) o f the ver t ices such t h a t (vs,, v,,+,) E A for t = 1, . . . , n 1 and (v~,,, v,,) ~ A. T h e p rob lem of f inding one or m o r e H a m i l t o n i a n circui ts in a given g r a p h (or a l te rna t ive ly of de te rmin ing t h a t the g raph does no t possess H a m i l t o n i a n circuits) is k n o w n to be long to the class of the NP-complete problems, so exac t e n u m e r a t i v e a lgor i thms or heur is t ic t echn iques are genera l ly used for its solut ion. Th i s pape r presents a p r o g r a m for solving the fol lowing genera l p rob lem, e i ther exact ly or heurist ical ly: