implement dijkstra algorithm and test it