Finding shortest path through undirected weighted graph with Dijkstra algorithm.