Shortest Paths - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Shortest Paths

Description:

FLIGHT TIMES. 4:05. 2:55. 2:20. 2:10. 3:50. 2:00. 1:15. 2:10. 1:40. 1:30. 1:55. 2:45. 0:50. 1:50 ... The length of a path in a weighted graph is the sum of the ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 33
Provided by: eca45
Learn more at: https://cis.temple.edu
Category:
Tags: flight | paths | shortest

less

Transcript and Presenter's Notes

Title: Shortest Paths


1
Shortest Paths
Text Discrete Mathematics and Its Applications
(5th Edition) Kenneth H. Rosen Chapter 8.6 Based
on slides from Chuck Allison, Michael T.
Goodrich, and Roberto Tamassia By Longin Jan
Latecki
2
Weighted Graphs
Graphs that have a number assigned to each edge
are called weighted graphs.
3
Weighted Graphs
MILES
860
2534
191
1855
722
908
957
760
606
834
349
2451
1090
595
4
Weighted Graphs
FARES
129
79
39
99
59
69
89
79
99
89
129
39
69
5
Weighted Graphs
FLIGHT TIMES
405
210
050
255
150
210
220
155
140
245
350
200
115
130
6
Weighted Graphs
  • A weighted graph is a graph in which each edge
    (u, v) has a weight w(u, v). Each weight is a
    real number.
  • Weights can represent distance, cost, time,
    capacity, etc.
  • The length of a path in a weighted graph is the
    sum of the weights on the edges.
  • Dijkstras Algorithm finds the shortest path
    between two vertices.

7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
Dijkstra's Algorithm
15
Dijkstra Animation
  • Demo

16
(No Transcript)
17
Unprocessed node adjacent to2 is 4. gt 1540
55 so replace with 55
18
(No Transcript)
19
Unprocessed node adjacent to5 is 3. 35 gt 2010
30 so replace 35 with 30
20
Unprocessed node adjacent to5 is 6. gt 2050
70 so replace with 70
21
Unprocessed node adjacent to5 is 7. gt 2075
95 so replace with 95
22
(No Transcript)
23
Unprocessed node adjacent to3 is 4. 55 lt 30 35
65 no change in array
24
(No Transcript)
25
Unprocessed node adjacent to4 is 6. 70 gt 55 10
65 so replace 70 with 65
26
(No Transcript)
27
(No Transcript)
28
Unprocessed node adjacent to6 is 7. 95 gt 65 15
80 so replace 95 with 80
29
(No Transcript)
30
All nodes have been processed Algorithm finishes.
31
Theorems
Dijkstras algorithm finds the length of a
shortest path between two vertices in a connected
simple undirected weighted graph.
Dijkstras algorithm uses O(n2) operations
(additions and comparisons) to find the length of
the shortest path between two vertices in a
connected simple undirected weighted graph.
32
Problem shortest path from a to z
f
b
d
5
5
4
7
3
1
4
2
a
z
4
3
c
e
g
5
5
a b c d e f g z
0 8 8 8 8 8 8 8
x 4(a) 3(a) 8 8 8 8 8
x x
Write a Comment
User Comments (0)
About PowerShow.com