Calculating single source Dijkstra path length