You are on page 1of 7

Assignment

Name:- M.Faheem
Roll No#: BMA172039
Subject: Operational Research

Shortest path algorithm


->Dijikstra algorithm
->Floyed warshal algorithm
Shortest path algorithm
an algoritm that is designed essentialy to find a path of
minimum length betwen two specified vertices of a
connected weighted graph.
Single source shortest path algorithm
->Its dfined as
Cost of shortest path from a source vertex u to a
definition v. Diagram
Dijkstra's Algirithm:
Dijkstra's algorithm is a greedy algorithm for solving
single source shortest path problem that provide us
with the shortest path from one particular source node
to all other nodes in the given graph.
Rules of Dijkstra's Algorithm:
🔹It can be applied on both directed and undirected
path
🔹it is applied on weighted graph
🔹for the algoritm to be aplicable the graph must be
conected ..
Diagram:
Dijkstra's Algorithm
Dijkstra's(G,W,S)
INITIALIZE -SINGLE-SOURSE(G,s)
1 for each vertex v ϵ G,V
2 v.d= ∞
3 V.π =NIL
4 s.d=0
5 S= Ø
6 Q=G‫۔‬V
7 while (Q ≠ Ø )
8 u=dequeue_min(Q)
9 S=SU(u)
10 for each vertex v ϵ adj[u]
11 if (v.d>u.d+w(u,v))
12 v.d=u.d +w(u,v) //update distance of v
13 v.π= u
14 return vd
Floyed warshal Algorithm:
🔹floyed warshal algorithm is an algorithm for findin
shortest path in a
weighted graph
🔹the graph may be weighted with a positive or
negative edge weight
🔹the graph may be directed or undirected .
🔹 if a node has not a directed path or link to any
other node then the
distance betwen these nodes are infinite
🔹if only on path betwen two nodes or vertices then it
said to be the
shortest distance
🔹the distance of vertice to itself is 0
Use of shortest path Algorithm
🔹weighted graph
🔹distance function or arry
🔹priority queu
🔹relaxation
Aplication of shortest path Algorithm .
🔹it is used in google map
🔹it is used in finding shortest path
🔹it is used in geographical map s
🔹to find location of map which refers to vertices of
graph
🔹 distance betwen the location refers to edge
🔹it is used in IP routing to find open shortest path
first
🔹 it is used in the telephone network
Dijkstra's Algorithm
Example
Find the shortest path from the given graph.
The distance from a to A is zero and initially all others
are infinite so allocate the minimum value and
processed to construct nodes.
Now the shortest path table as

You might also like