Dijkstra Algorithm implementation.