Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Dijkstra Algorithm

The Dijkstra algorithm is one of the most famous algorithms in the world of computer science. It is a single-source shortest path algorithm that authorises us to discover the shortest path between any two vertices of a graph.

Here, the meaning of single-source is that we only have one source, and we have to discover the shortest route from the source to all the nodes.

Table of Contents

What is the Dijkstra Algorithm?

The Dijkstra is an iterative algorithm that finds the fastest path from a particular origin node to all other nodes in a graph. It varies from the least spanning tree in that the fastest distance between two vertices may not involve all of the graph’s vertices.

It’s worth noting that Dijkstra’s algorithm is appropriate only when all weights are favourable, as the weights of the edges are added to find the shortest path during implementation.

History of Dijkstra Algorithm

This algorithm was designed and disseminated by Dr Edsger W. Dijkstra, a shining Dutch computer scientist.

It was about 1959, he issued an article of about three pages. The title of the page was: “A note on two problems in connexion with graphs”. Here, he explained the whole algorithm.

Working of Dijkstra Algorithm

The algorithm works by maintaining a set of nodes, called the frontier, which contains all the nodes that have been visited but not yet processed. The algorithm then repeatedly expands the frontier by choosing the node with the lowest weight and adding its neighbors to the frontier. This process continues until the destination node is reached, at which point the shortest path to the destination has been found.

Dijkstra’s algorithm is guaranteed to find the shortest path from the source to the destination, if such a path exists. However, it is not guaranteed to find the shortest path if there are multiple paths with the same weight.

Advantages of Dijkstra’s Algorithm

  • It is used in Google Maps.
  • It is employed to identify the shortest path.
  • It is very popular in the Geographical Maps.
  • It is used to locate the points on the map that correspond to the graph’s vertices.
  • In order to identify the Open Shortest Path First, it is needed in IP routing.
  • The telephone network makes use of it.

Disadvantages of Dijkstra Algorithm

  • It conducts a blind scan, which takes a lot of processing time.
  • It is unable to manage sharp edges. As a result, acyclic graphs are produced, and the ideal shortest path is frequently impossible to find.

Applications of Dijkstra’s Algorithm

  • To determine the quickest route
  • In applications for social networking
  • Within a phone network
  • To locate the places on the map

Complexity of Dijkstra’s Algorithm

  • The time complexity is: O(E Log V).
  • Where E represents the edges and V indicates the vertices.
  • The space complexity is: O(V)

Keep learning and stay tuned to BYJU’S to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2024, GATE Admit Card, GATE Application Form, GATE Syllabus, GATE Cutoff, GATE Previous Year Question Paper, and more.

Also Explore,