AlgorithmsComputer Science & Information Technology

Dijkstra Algorithm

Dijkstra’s algorithm, named after its discoverer, Dutch computer scientist Edsger Dijkstra, is a greedy algorithm that solves the single-source shortest path problem for a directed graph G = (V, E) with non-negative edge weights i.e. we assume that w(u, v) ≥ 0 for each edge (u, v) ∈ E.

Dijkstra’s algorithm maintains a set of S of vertices whose final shortest-path weights from the source have already been determined. That is, all vertices v ∈ S, we have d[v] = δ(s, v) the algorithm repeatedly selects the vertex u ∈ V-S with the minimum shortest-path estimate, inserts u into S and relaxes all edges leaving u. We maintain a min-priority queue Q that contains all the vertices in V – s keyed by their d values. Graph G is represented by adjacency lists.

DIJKSTRA (G, w, s)

1. INITIALIZE-SINGLE-SOURCE (G, s)
2. S ← φ
3. Q ← V[G]
4. while Q ≠ φ
5. do u ← EXTRACT-MIN (Q)
6. S ← S ∪ {u}
7. for each vertex v ∈ Adj[u]
8. do RELAX (u, v, w)

Dear Aspirants,
Your preparation for GATE, ESE, PSUs, and AE/JE is now smarter than ever — thanks to the MADE EASY YouTube channel.
This is not just a channel, but a complete strategy for success, where you get toppers strategies, PYQ–GTQ discussions, current affairs updates, and important job-related information, all delivered by the country’s best teachers and industry experts.
If you also want to stay one step ahead in the race to success, subscribe to MADE EASY on YouTube and stay connected with us on social media.
MADE EASY — where preparation happens with confidence.

MADE EASY

MADE EASY is a well-organized institute, complete in all aspects, and provides quality guidance for both written and personality tests. MADE EASY has produced top-ranked students in ESE, GATE, and various public sector exams. The publishing team regularly writes exam-related blogs based on conversations with the faculty, helping students prepare effectively for their exams.

Leave a Reply

Your email address will not be published. Required fields are marked *