add a computation of the minimal distance