For the purposes of a lecture in graph theory, I created the following example of a Hamiltonian graph consisting of the complete graphs ,
and
joined pairwise by an edge:

The Python library NetworkX can be used to perform many of the calculations that arise in graph theory and networks and I used it in this case to list and count all the Hamiltonian cycles in the above graph. In the present post, I want to quickly record the Python code I used for this (in a Jupyter Notebook):


