Source: https://members.loria.fr/CPierrot/papers/mines_td6.pdf