-
What algorithm would you use to count all the Hamiltionian paths in a $n \times m$ grid graph ($n$ and $m<10$) from a given starting vertex to an ending one?
-
How can you determine if this grid graph has holes?
Thanks in advance.
co.combinatoricsgraph theory
What algorithm would you use to count all the Hamiltionian paths in a $n \times m$ grid graph ($n$ and $m<10$) from a given starting vertex to an ending one?
How can you determine if this grid graph has holes?
Thanks in advance.
Best Answer
Here is Mathematica code that finds all the Hamiltonian paths between opposite corners of a $5 \times 5$ grid graph:
Addendum. Setting $n=7$ to compute the comparable number for a $7 \times 7$ grid returns 223,424 Hamiltonian paths between opposite corners. [5 hrs computation time on a 2.5GHz laptop.] The first one returned is: