added return value of shortestPath ()