Dijsktra's algorithm for finding the optimal path between two cells. Short description of the algorithm: