a few code for dijkstra