shipping routes uva bfs shortest path finding problem