Fixed dijkstra reverse algorithm error.