Source: https://www.montefiore.uliege.be/~geurts/Cours/iti/2012/05-graphes-part1-2012-2013.pdf