implement dijkstra algorithm

Dijkstra algorithm: for finding shortest paths