Congratulations! You’ve implemented the Hamiltonian algorithm to find both Hamiltonian paths and cycles within a graph!

In this lesson, you have learned:

  • What a Hamiltonian path is
  • What a Hamiltonian cycle (circuit) is
  • How to convert a graph into input data for the Hamiltonian algorithm via a vertex list and adjacency matrix
  • How to implement the Hamiltonian algorithm to search for paths and cycles programmatically



Returning to the example graph we introduced in the Backtracking exercise, execute the code on that graph and its adjacency matrix (adjacency_matrix2) to see what paths and cycles are found.


Create additional adjacency matrices for various graphs to test more with!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?