Finds the shortest path between nodes in a weighted graph using a priority queue.
Priority queue + dist[] array — O(V) nodes