Update dijkstra.cpp

Handle some bugs