finished hamiltonian cycle solver