Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dijkstra's Shortest Path Algorithm #260

Open
qingquan-li opened this issue Dec 19, 2023 · 0 comments
Open

Dijkstra's Shortest Path Algorithm #260

qingquan-li opened this issue Dec 19, 2023 · 0 comments

Comments

@qingquan-li
Copy link
Owner

Definition: The shortest path algorithm, is a greedy algorithm, developed by Dijkstra. Dijkstra's algorithm is a method for finding the shortest path from a single source vertex to all other vertices in a graph.

Type of Graph: Works on both directed and undirected graphs, as long as the weights are non-negative.

Mechanism:

  • Initially, set the distance to the source vertex as 0 and all other vertices as infinity (∞).
  • Use a priority queue to keep track of vertices with the shortest distance that haven't been processed (visited) yet.
  • Repeatedly extract the vertex with the smallest distance, update the distances to its adjacent vertices, and mark it as processed (visited).

Greedy Approach: At every step, the algorithm greedily chooses the next vertex with the smallest known distance from the source.

Apply Dijkstra's Algorihm to find the shortest path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant