0% found this document useful (0 votes)
74 views4 pages

IPG - 2014027 Dijkstra's Shortest Path Algorithm

This document contains two examples demonstrating the application of Dijkstra's shortest path algorithm on graphs. The first is a directed graph showing the distances and predecessors for each vertex as the algorithm runs. The second is an undirected graph also showing the distances and predecessors at each step. Both examples include a final table listing the shortest distance to reach each vertex.

Uploaded by

Ravi Tej
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views4 pages

IPG - 2014027 Dijkstra's Shortest Path Algorithm

This document contains two examples demonstrating the application of Dijkstra's shortest path algorithm on graphs. The first is a directed graph showing the distances and predecessors for each vertex as the algorithm runs. The second is an undirected graph also showing the distances and predecessors at each step. Both examples include a final table listing the shortest distance to reach each vertex.

Uploaded by

Ravi Tej
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DAA Assignment

Dijkstra's Shortest Path


Algorithm
By
B. Ravi Chandra

IPG_2014027
First Graph with Application of Dijkstras
Algorithm::
This is a directed Graph.
1
40
10 5

2 20 70
20 100
50 6
3 4
60
30
1
10 inf 20 40 inf D
1 0 1 1 0
P
1,2
10 60 20 40 inf D
1 2 1 1 0
P
1,2,4
10 50 20 40 80 D
1 4 1 4 4
P
1,2,4,5
10 50 20 40 80 D
1 4 1 4 4
P
1,2,4,5,3
10 50 20 40 80 D
1 4 1 4 4
P
1,2,4,5,3,6
10 50 20 40 80 D
1 4 1 4 4
P
P[2] P[3] P[4] P[5] P[6]
1 4 1 4 4

Vertex Distance
2 10
3 50
4 20
5 40
6 80

Second Graph with Application of Dijkstras Algorithm::


This is an undirected Graph.

4 8
8 5
4
2

4
3
3

1
4 Inf 8 inf D
1 0 1 0
P

1,2
4 7 8 18 D
1 2 1 0
P
1,2,3
4 7 8 18 D
1 2 1 0
P

1,2,3,4
4 7 8 15 D
1 2 1 0
P
1,2,3,4,5
4 7 8 15 D
1 2 1 0
P
P[2] P[3] P[4] P[5]
1 2 1 0

Vertex Distance
2 4
3 7
4 8
5 15

You might also like