verified ShortestPath.cpp