# find shortest paths from source to all vertices using Dijkstra’s Algorithm?

For Dijkstra’s,i can find shortest paths from source to all vertices in the given graph but how can i calling the algorithm |V| times taking each vertex as a source and store all tables ??? For example : What is the shortest path from 1 to 4? You need to print the value and the exact path vertices starting from 1 and ending at 4.

• I think you need to provide more detail for us to understand the question.
– 6005
May 14 '20 at 12:30

First, to find the shortest path between all pairs of vertices, you can create a $$|V|^2$$ matrix where row and column i and j corresponds to the shortest distance from vertex i to vertex j.