Source: https://jeffe.cs.illinois.edu/teaching/algorithms/models/02-regular.pdf