a variation of the shortest path problem