0% found this document useful (0 votes)
4 views

Dijkstra's Algorithm

Dijkstra's Algorithm, developed by Edsger Dijkstra in 1956, is used to find the shortest paths between nodes in a weighted graph, commonly applied in GPS navigation and network routing. The algorithm starts from a source node, updates distances to adjacent nodes, and iteratively visits the closest unvisited node until all nodes are processed. While efficient for non-negative weights, it has limitations with negative weight edges and can be slow on large graphs.

Uploaded by

Ankita Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Dijkstra's Algorithm

Dijkstra's Algorithm, developed by Edsger Dijkstra in 1956, is used to find the shortest paths between nodes in a weighted graph, commonly applied in GPS navigation and network routing. The algorithm starts from a source node, updates distances to adjacent nodes, and iteratively visits the closest unvisited node until all nodes are processed. While efficient for non-negative weights, it has limitations with negative weight edges and can be slow on large graphs.

Uploaded by

Ankita Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Dijkstra's Algorithm

• Finding the Shortest Path Between Cities

• Submitted by-

• Didhiti Rai [RA2311003011013]

• Adhira Srikanth [RA2311003011023]


• Tanisha Ghosh [RA2311003011024]
Introduction to
Dijkstra’s
Algorithm
Dijkstra's algorithm was developed
by Edsger Dijkstra, a Dutch computer
scientist in 1956.
It is an algorithm for finding
the shortest paths between nodes in a
weighted graph, which may represent,
for example, a road network.
It utilizes a priority queue to
continuously determine the closest
vertex not yet processed, updating the
shortest path dynamically based on
edge weights.
How Dijkstra's
Algorithm Works
1. Start from a source node (city).
2. Assign initial distances (0 for the source, ∞
for others).
3. Visit the nearest unvisited node.
4. Explore adjacent nodes and updates
their distances if a shorter path is
found.
5. Repeat until all nodes are visited.

The final output is a map of the shortest


paths from the source to every other node
in the graph, illustrating the most efficient
routes based on weights assigned to
edges.
Visualization of Dijkstra's Algorithm

•Start from A (set its distance to 0, all others to ∞).


•Mark all nodes as unvisited.
•Visit the nearest unvisited node (A)
•Update distances to its neighbors (D = 4, B = 10) &
mark A as visited.
•Visit the next closest node (D = 4)
•Update distances: B (now 6 via D), E (10) & mark D as
visited.
•Visit the next closest node (B = 6)
•Update C (14) & mark B as visited.
•Visit the next closest node (E = 10)
•Update F (22) & mark E as visited.
•Visit C (14) → Update neighbors if needed.
•Visit F (final node, 22) → Shortest paths are
determined.
Applications of
Dijkstra's Algorithm
• Pathfinding in GPS Navigation: analyzes the
network of roads as a graph where intersections are
nodes and roads are edges, the algorithm computes the
most efficient path, accounting for various conditions
such as distance and traffic.

• Network Routing: assists in determining the optimal


path for data packets traveling across the internet.

• Graph Traversal in AI: calculates the shortest paths


in a virtual graph representing obstacles and navigable
areas, facilitating efficient movement and decision-
making processes for autonomous agents.
Limitations of
Dijkstra's
Algorithm
Despite its efficiency, Dijkstra's
Algorithm has notable limitations. It
cannot handle graphs with negative
weight edges, as it may lead to
incorrect path calculations.

Additionally, the algorithm can be


inefficient on large graphs due to its
time complexity, especially if
implemented with a basic priority
queue. This results in slower
performance compared to other
algorithms, such as A*, in certain
scenarios.
Simulation
Overview
This simulation demonstrates how Dijkstra’s
Algorithm efficiently finds the shortest path
between multiple cities. In the simulation:
• Cities are represented as nodes, while
roads are weighted edges, indicating the
distance or travel cost between them.
• The algorithm analyzes all possible routes
and highlights the optimal path from the
starting city to the destination.
• By iteratively selecting the shortest
available route, the simulation visually
showcases how Dijkstra’s Algorithm
navigates through the network to
determine the most efficient path.
Simulation
Conclusion
s
Dijkstra's Algorithm remains a foundational tool in
computer science and engineering, vital for
applications that require efficient pathfinding. Its
strengths in handling non-negative weighted graphs
make it suitable for various fields, although users
must be aware of its limitations, particularly with
negative weights. Understanding its operation and
applications allows for better implementation in real-
world problems.

You might also like