Cycles · Hamiltonian Graphs

Lesson 9

Nikolai Chukhin · Alexander S. Kulikov

The considered proof is algorithmic and implemented in the library \(\texttt{networkx}\).

import networkx as nx
from networkx.algorithms import tournament

G = tournament.random_tournament(n=10, seed=17)
A = nx.nx_agraph.to_agraph(G)
A.layout(prog='circo')
A.draw("tournament.png")
print(tournament.hamiltonian_path(G))

[1, 0, 8, 2, 4, 3, 5, 9, 6, 7]