Download presentation

Presentation is loading. Please wait.

Published byBryanna Farnsworth Modified about 1 year ago

1
Lecture 6 Shortest Path Problem

2
s t

3
Dynamic Programming

4
Dijkstra’s Algorithm is motivated from a way to implement of this dynamic programming.

5
Dynamic Programming

6
Lemma Proof

7
Theorem

8
Counterexample

9
Smart Implementation

10
An Example Initialize 1 0 Select the node with the minimum temporary distance label.

11
Update Step 1

12
Choose u such that N_(u) S

13
Update Step The predecessor of node 3 is now node 2

14
Choose u Such That N_(u) S 3

15
Update d(5) is not changed

16
Choose u s.t. N_(u) S 5

17
Update 5 d(4) is not changed 6

18
Choose u s.t. N_(u) S

19
Update d(6) is not updated

20
Choose u s.t. N_(u) S There is nothing to update

21
End of Algorithm All nodes are now permanent The predecessors form a tree The shortest path from node 1 to node 6 can be found by tracing back predecessors

22
Dijkstra’s Algorithm

23

24
Lemma

25

26
Proof of Lemma s u w S T

27
Theorem

28
Counterexample

29

30

31

32

33

34

35

36

37
Dijkstra’s Algorithm

38
An Example Initialize 1 0 Select the node with the minimum temporary distance label.

39
Update Step 1

40
Choose Minimum Temporary Label

41
Update Step The predecessor of node 3 is now node 2

42
Choose Minimum Temporary Label 3

43
Update d(5) is not changed

44
Choose Minimum Temporary Label 5

45
Update 5 d(4) is not changed 6

46
Choose Minimum Temporary Label

47
Update d(6) is not updated

48
Choose Minimum Temporary Label There is nothing to update

49
End of Algorithm All nodes are now permanent The predecessors form a tree The shortest path from node 1 to node 6 can be found by tracing back predecessors

50

51

52

53

54

55

56

57

58

59

60
Dijkstra’s Algorithm with simple buckets (also known as Dial’s algorithm)

61
An Example Initialize distance labels 1 0 Select the node with the minimum temporary distance label Initialize buckets.

62
Update Step 1

63
Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket

64
Update Step

65
Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket.

66
Update

67
Choose Minimum Temporary Label 6 45

68
Update

69
Choose Minimum Temporary Label

70
Update

71
Choose Minimum Temporary Label There is nothing to update

72
End of Algorithm All nodes are now permanent The predecessors form a tree The shortest path from node 1 to node 6 can be found by tracing back predecessors

73

74

75

76
Implementations With min-priority queue, Dijkstra algorithm can be implemented in time With Fibonacci heap, Dijkstra algorithm can be implemented in time With Radix heap, Dijkstra algorithm can be implemented in time

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google