Source: https://www.fil.univ-lille1.fr/~L2S3API/CoursTP/Projets/Hamilton/hamilton.pdf