fixed some bugs in ShortestPath.cpp