Finding the shortest paths in a network