changed shortestPath()

min function