Fast computation of all pairs of geodesic distances