Dijkstra's Algorithm: QUDRAT ULLAH (12915) ABDUL HASEEB (13037)

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

Dijkstra's algorithm

QUDRAT ULLAH (12915)


ABDUL HASEEB (13037)
Contents
● Introduction
● Purpose
● Algorithm for Dijkstra’s
● Application
● Example
● Pseudocode
● Time Complexity
INTRODUCTION
● Dutch scientist Edsger Dijkstra’s in 1956.
● Dijkstra’s algorithm is also known as the shortest path algorithm. It is an algorithm
used to find the shortest path between nodes of the graph. The algorithm creates the
tree of the shortest paths from the starting source vertex from all other points in the
graph.
Purpose
● With Dijkstra's Algorithm, you can find the shortest path between nodes in a graph.
Particularly, you can find the shortest path from a node (called the "source node") to
all other nodes in the graph, producing a shortest-path tree.
Algorithm for Dijkstra’s
● To know how Dijkstra's algorithm works behind the scene, look at the below steps to
understand it in detail:
● First of all, we will mark all vertex as unvisited vertex
● Then, we will mark the source vertex as 0 and all other vertices as infinity
● Consider source vertex as current vertex
● Calculate the path length of all the neighboring vertex from the current vertex by
adding the weight of the edge in the current vertex
Continue…
● Now, if the new path length is smaller than the previous path length then replace it
otherwise ignore it
● Mark the current vertex as visited after visiting the neighbor vertex of the current
vertex
● Select the vertex with the smallest path length as the new current vertex and go back
to step 4.
● Repeat this process until all the vertex are marked as visited.
Example

Applications
● It is used to find the shortest distance between two locations along the path on Google
maps.
● It is used in telephone networking to find the shortest path for finding the nearest
switching station for transmission.
Pseudocode

Time Complexity
●Thank You

You might also like