A linear-time algorithm to compute geodesics in