First naive Dijkstra algorithm.
Second try Dijkstra algorithm.
Third try Dijkstra algorithm. Should be fine now.
Added description for function dijkstra.