Implement the backtracking algorithm for Hamiltonian Cycle in Algoraph. When you create the algorithm, use PuzzleInstance as the data type. Your algorithm should either output the Hamiltonian cycle by listing the vertices in the proper order (with spaces between) or "no" if there is no Hamiltonian cycle.
Run your algorithm on the following puzzles
- Lemek (8 vertices)
- First Class (9 vertices)
- Pete (10 vertices)
- Lemeker (12 vertices)
- 4 Realz (15 vertices)
- Sierpinski Triangle (15 vertices)
- c4xc4 (16 vertices)
- Hyped Up (16 vertices)
- Lemke Kid (16 vertices)
- Crossover (17 vertices)
- Smal Snake (17 vertices)
- Lemke9xC2 (18 vertices)
- Dode (20 vertices)
- K20 TSP (20 vertices)
- Webby Spider (24 vertices)
- Choices! (25 vertices)
- Spikey (26 vertices)
- Tale of Wires (31 vertices)
- Snake (35 vertices)
- Torus 6x6 (36 vertices)
- Gridlick (42 vertices)
- Bullseye (48 vertices)
- Grid Be Gone (49 vertices)
You should be able to modify the algorithm ValidTSPSolutionChecker
to check the validity of the solutions produced by your algorithm.
Along with your code, submit a file results7_1.txt that lists all of the above graphs and gives the solution for each. List the solution as "did not finish" for any that your algorithm could not get an answer for.