An efficient algorithm for computing free distance (Corresp.)