Calculates the shortest path between two locations