Source: https://www.cs.tau.ac.il/~bchor/CM/Compute1_DFA.pdf