Skip to content

Given a graph and a source vertex in the graph, find the shortest paths and shortest distance from the source to all vertices in the given graph.

Notifications You must be signed in to change notification settings

LakshmiVadhanie/FINDING-SHORTEST-PATH-AND-IT-S-DISTANCE-BETWEEN-TWO-LOCATIONS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FINDING-SHORTEST-PATH-AND-IT-S-DISTANCE-BETWEEN-TWO-LOCATIONS

Given a graph and a source vertex in the graph, find the shortest paths and shortest distance from the source to all vertices in the given graph.

Dijkstra's Algorithm finds the shortest path between a given node (which is called the "source node") and all other nodes in a graph. This algorithm uses the weights of the edges to find the path that minimizes the total distance (weight) between the source node and all other nodes. Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning tree. Like Prim’s MST, we generate a SPT (shortest path tree) with a given source as a root. We maintain two sets, one set contains vertices included in the shortest-path tree, other set includes vertices not yet included in the shortest-path tree. At every step of the algorithm, we find a vertex that is in the other set (set of not yet included) and has a minimum distance from the source.

About

Given a graph and a source vertex in the graph, find the shortest paths and shortest distance from the source to all vertices in the given graph.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published