Lecture 6 Shortest Path Problem.

Slides:



Advertisements
Similar presentations
and 6.855J Dijkstras Algorithm with simple buckets (also known as Dials algorithm)
Advertisements

Single Source Shortest Paths
15.082J & 6.855J & ESD.78J Shortest Paths 2: Bucket implementations of Dijkstra’s Algorithm R-Heaps.
and 6.855J February 25, 2003 Radix Heap Animation.
Lecture 6 Shortest Path Problem. s t Dynamic Programming.
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
15.082J & 6.855J & ESD.78J September 23, 2010 Dijkstra’s Algorithm for the Shortest Path Problem.
Lecture 7 All-Pairs Shortest Paths. All-Pairs Shortest Paths.
Length of a Path The weight (length) of a path is the sum of the weights of its edges. adcbe Path p: Edge weights: w(a, b) = 7, w(b, c) = 2, w(c,
E E Module 5 © Wayne D. Grover 2002, (for non-negative edge weights only) Key concepts: “labelling”, “scanning” Label = {distance, predecessor}.
15.082J & 6.855J & ESD.78J September 30, 2010 The Label Correcting Algorithm.
Lecture: Priority Queue
Lecture 13 Shortest Path.
Lecture 5 Dynamic Programming
Network Simplex Animations
Lecture 5 Dynamic Programming
EMIS 8374 Dijkstra’s Algorithm Updated 18 February 2008
Dijkstra’s Algorithm with two levels of buckets
Party-by-Night Problem
Lecture 7 All-Pairs Shortest Paths
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
Introduction to Maximum Flows
15.082J & 6.855J & ESD.78J Visualizations
15.082J & 6.855J & ESD.78J Visualizations
Dijkstra’s Algorithm for the Shortest Path Problem
Breadth first search animation
Lecture 4 Graph Search.
Introduction to Minimum Cost Flows
Spanning Tree Algorithms
and 6.855J Flow Decomposition
Primal-Dual Algorithm
All pairs shortest path problem
Successive Shortest Path Algorithm
and 6.855J March 6, 2003 Maximum Flows 2
15.082J & 6.855J & ESD.78J Radix Heap Animation
Network Optimization Depth First Search
Introduction to Algorithms
Min Global Cut Animation
Autumn 2016 Lecture 10 Minimum Spanning Trees
Dijkstra’s Algorithm for Shortest Paths
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
Reading before Lecture 13
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
Network Optimization Topological Ordering
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
and 6.855J Dijkstra’s Algorithm
Lecture 6 Shortest Path Problem.
Visualizations Dijkstra’s Algorithm
Introduction to Maximum Flows
Network Simplex Animations
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
Eulerian Cycles in directed graphs
and 6.855J Topological Ordering
15.082J & 6.855J & ESD.78J Visualizations
Implementation of Dijkstra’s Algorithm
The Minimum Cost Spanning Tree Problem
and 6.855J Depth First Search
Breadth first search animation
Lecture 12 Shortest Path.
OPIM 915 Fall 2010 Data Structures 23-38,
Prim’s algorithm for minimum spanning trees
Winter 2019 Lecture 10 Minimum Spanning Trees
Introduction to Maximum Flows
Max Flows 3 Preflow-Push Algorithms
Class 11 Max Flows Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow.
15.082J & 6.855J & ESD.78J Visualizations
Data Structures and Algorithm Analysis Lecture 8
Presentation transcript:

Lecture 6 Shortest Path Problem

Quiz Sample True or False Every dynamic programming can be analyzed with formula: Run-time = (table size) x (computation time of recursive formula). Answer: False A counterexample can be seen in study of the shortest path problem.

s t

Dynamic Programming

Dynamic Programming

Dynamic Programming

Find the shortest path from a network with nonnegative edge weights. Dijkstra’s Algorithm Find the shortest path from a network with nonnegative edge weights.

Dijkstra’s Algorithm

Lemma

Lemma

Proof of Lemma T w u S s

Dijkstra’s Algorithm Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

An Example      Initialize 4 2 4 2 2 1 2 3 1  1 6 4 2 3 3 5   Initialize Select the node with the minimum temporary distance label.

Update Step 2   4 2 4 2 2 1 2 3  1 6 4 2 3 3 5   4

Choose Minimum Temporary Label 2  4 2 4 2 2 1 2 3  1 6 4 2 3 3 5  4

Update Step 6 2    4 4 3 The predecessor of node 3 is now node 2 4 1 2 3  1 6 4 2 3 3 5  4 4 3 The predecessor of node 3 is now node 2

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5 3 4

Update 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5 3 4 d(5) is not changed.

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5 3 4

Update 2 6 4 2 4 2 2 6 1 2 3  1 6 4 2 3 3 5 3 4 d(4) is not changed

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4

Update 2 6 4 2 4 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4 d(6) is not updated

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4 There is nothing to update

End of Algorithm 2 6 6 3 4 All nodes are now permanent 1 2 3 6 1 6 4 2 3 3 5 3 4 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

Theorem

Counterexample 4 -2 -2 2 1

Counterexample 3 -2 -2 1 2

Counterexample 4 -2 -2 1 2

Counterexample 4 -2 -2 1 2

Counterexample 4 -2 -2 1 2

Dijkstra’s Algorithm with simple buckets (also known as Dial’s algorithm) Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)

An Example Initialize distance labels  Initialize buckets.  4 2 4 2 2 Initialize buckets. 1 2 3 1 1 6 4 2 Select the node with the minimum temporary distance label. 3 3 5  2 3 4 5 6 1 2 3 4 5 6 7 1

Update Step 2   4 2 4 2 2 1 2 3  1 6 4 2 3 3 5    4 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3

Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket. 2  4 2 4 2 2 1 2 3  1 6 4 2 3 3 5   4 1 2 3 4 5 6 7 4 5 6 2 3

Update Step 6 2  4 2 4 2 2 1 2 3  1 6 4 2 3 3 5   4 4 3 1 2 3 4 5 6 7 4 5 6 2 3 3 4 5

Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket. 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5  3 4 1 2 3 4 5 6 7 6 3 5 4

Update 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5  3 4 1 2 3 4 5 6 7 6 3 5 4

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3  1 6 4 2 3 3 5  3 4 1 2 3 4 5 6 7 6 5 4

Update 2 6 4 2 4 2 2 6 1 2 3  1 6 4 2 3 3 5  3 4 1 2 3 4 5 6 7 6 5 4 6

Choose Minimum Temporary Label 2 6 4 2 4 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4 1 2 3 4 5 6 7 4 6

Update 2 6 4 2 4 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4 1 2 3 4 5 6 7 4 6

Choose Minimum Temporary Label 2 6 4 2 4 There is nothing to update 2 2 1 2 3 6 1 6 4 2 3 3 5 3 4 1 2 3 4 5 6 7 6

End of Algorithm 2 6 6 3 4 All nodes are now permanent 1 2 3 6 1 6 4 2 3 3 5 3 4 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

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