View
75
Download
0
Embed Size (px)
Citation preview
WELCOME
ContentsIntroduction
How it works
Algorithm & simulation
Problem discussion
Simulation of problem
Screen shot of Output
Presented by
Anika OhabID:142-15-3568
Abul HasnathID:142-15-3532
Umme HabibaID: 142-15-3677
Shahinur Rahman ID: 142-15-3606
Introduction• Dijkstra's Algorithm derived by a Dutch
computer scientist ‘Edsger Dijkstra’ in 1956 and published in 1959.
• It’s a graph search algorithm that solves the single-source shortest path problem for a graph with nonnegative edge path costs, producing a shortest path tree.
• This algorithm is often used in routing and as a subroutine in other graph algorithms.
How it works ?
• This algorithm finds the path with lowest cost (i.e. the shortest path) between that vertex and every other vertex. For example, if the vertices of the graph represent cities and edge path costs represent driving distances between pairs of cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest route between one city and all other cities.
• According to this algorithm, to solve a given problem, we need to solve different parts of problems.
• What is shortest path ? shortest length between two vertices for an
unweighted graph: smallest cost between two vertices for a
weighted graph: B
D
C
A
E
B
D
C
A
E
200
60
130
190450
210
weighted graph
unweighted graph
\
Shortest Path Problems
7
How Dijkstra Works
0
10
1
5
2
s
t x
y z
2 3
9
7
4 6
0
10
1
5
2
s
t x
y z
2 3
9
7
4 6
10
5
1. INITIALIZE-SINGLE-SOURCE(V, s)
2. S ← 3. Q ← V[G]4. while Q 5. do u ← EXTRACT-MIN(Q)6. S ← S {u} 7. for each vertex v Adj[u]8. do RELAX(u, v, w)
8
Example
0
10
5
10
1
5
2
s
t x
y z
2 3
9
7
4 6
8 14
7
0
8 14
5 7
10
1
5
2
s
t x
y z
2 3
9
7
4 6
13
0
8 13
5 7
10
1
5
2
s
t x
y z
2 3
9
7
4 6
9
0
8 9
5 7
10
1
5
2
s
t x
y z
2 3
9
7
4 6
Problem :- Out Computers are connected to global through
Internet connection. The internet connection has a lots routers for routing their packet data.
Suppose I wants to send a packet to my USA server computer.A router can forward a packet to its destination in a shortest path. So we can program router for finding shortest path for sending data to it’s destination using Dijkstra Algorithm.
Graph Algorithm• In this
interconnected ‘Vertex’ we’ll use ‘Dijkstra’s Algorithm’.
• To use this algorithm in this network we have to start from a decided vertex and then continue to others.
Simulation Of Our problemSo, for the calculation give infinite value to all Vertex. And start with ‘A’ using this table:
Graph Algorithm
Graph Algorithm
Graph Algorithm
Graph Algorithm
Graph Algorithm
Graph Algorithm
Graph Algorithm
Graph Algorithm• So with this ‘Graph Algorithm’ we found our best
lowest cost route in this interconnected Vertex.• And the best lowest cost path is given below:
A B F C D G• So total cost from ‘A’ to ‘G’ vertex is ‘70’ which is
lowest cost from other Vertex.
Implementation Output
Implementation Output
Implementation Output
Implementation Output
http://bit.ly/Video-On-BFS
[email protected] Twitter.com/HassnainJamil