Source: https://igm.univ-mlv.fr/~alabarre/teaching/graphes/chap02-parcours.pdf