Lecture 6 Shortest Path Problem. s t Dynamic Programming.

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.
Chapter 5 Shortest Paths: Label-Correcting Algorithms
Introduction to Algorithms 6.046J/18.401J/SMA5503
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
Lecture 19: Shortest Paths Shang-Hua Teng. Weighted Directed Graphs Weight on edges for distance
1 Dijkstra's Shortest Path Algorithm Find shortest path from s to t. s 3 t
1 Dijkstra's Shortest Path Algorithm Find shortest path from s to t. s 3 t
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
CSE 421 Algorithms Richard Anderson Lecture 10 Minimum Spanning Trees.
1 Routing Algorithms. 2 Outline zBellaman-Ford Algorithm zDijkstra Algorithm.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 21 Introduction to Computer Networks.
Quickest Route B St Li C La time matrix (minutes) Liskeard Launceston Callington St Austell Bodmin 32 What is the quickest route from.
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
A Shortest Path Algorithm. Motivation Given a connected, positive weighted graph Find the length of a shortest path from vertex a to vertex z.
Dijkstra’s Algorithm. 2 Shortest-path Suppose we want to find the shortest path from node X to node Y It turns out that, in order to do this, we need.
Shortest Path. Dijkstra’s Algorithm finds the shortest path from the start vertex to every other vertex in the network. We will find the shortest path.
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.
Introduction to Algorithms Jiafen Liu Sept
Week 12 - Monday.  What did we talk about last time?  Topological sort and cycle detection in directed graphs  Connectivity  Strong connectivity.
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.
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali :
Dijkstra animation. Dijksta’s Algorithm (Shortest Path Between 2 Nodes) 2 Phases:initialization;iteration Initialization: 1. Included:(Boolean) 2. Distance:(Weight)
Lecture: Priority Queue. Questions Is array a data structure? What is a data structure? What data structures are implemented by array? Priority queue.
CS38 Introduction to Algorithms Lecture 3 April 8, 2014.
Lecture: Priority Queue
Shortest Paths CONTENTS Introduction to Shortest Paths (Section 4.1)
Shortest Path from G to C Using Dijkstra’s Algorithm
Lecture 13 Shortest Path.
Network Flow Problems – Shortest Path Problem
EMIS 8374 Dijkstra’s Algorithm Updated 18 February 2008
Dijkstra’s Algorithm with two levels of buckets
Party-by-Night Problem
Dijkstra’s Algorithm We are given a directed weighted graph
Edmonds-Karp Algorithm
15.082J & 6.855J & ESD.78J Visualizations
Dijkstra’s Algorithm for the Shortest Path Problem
15.082J & 6.855J & ESD.78J Visualizations
Lecture 6 Shortest Path Problem.
Shortest Path.
Shortest Path.
Dijkstra’s Algorithm for the Shortest Path Problem
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Advanced Algorithms Analysis and Design
Autumn 2015 Lecture 10 Minimum Spanning Trees
Dijkstra’s Shortest Path Algorithm Neil Tang 03/25/2008
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
All pairs shortest path problem
Shortest Path.
15.082J & 6.855J & ESD.78J Radix Heap Animation
Weighted Graphs & Shortest Paths
Autumn 2016 Lecture 10 Minimum Spanning Trees
Dijkstra’s Algorithm for Shortest Paths
and 6.855J Dijkstra’s Algorithm
Lecture 6 Shortest Path Problem.
Visualizations Dijkstra’s Algorithm
Implementation of Dijkstra’s Algorithm
Dijkstra Algorithm examples
Lecture 12 Shortest Path.
Prim’s algorithm for minimum spanning trees
Winter 2019 Lecture 10 Minimum Spanning Trees
15.082J & 6.855J & ESD.78J Visualizations
Presentation transcript:

Lecture 6 Shortest Path Problem

s t

Dynamic Programming

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

Dynamic Programming

Lemma Proof

Theorem

Counterexample

Smart Implementation

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

Update Step      1

Choose u such that N_(u) S   

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

Choose u Such That N_(u) S  3

Update d(5) is not changed 

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

Update  5 d(4) is not changed 6

Choose u s.t. N_(u) S

Update d(6) is not updated

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

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

Dijkstra’s Algorithm

Lemma

Proof of Lemma s u w S T

Theorem

Counterexample

Dijkstra’s Algorithm

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

Update Step      1

Choose Minimum Temporary Label   

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

Choose Minimum Temporary Label  3

Update d(5) is not changed 

Choose Minimum Temporary Label  5

Update  5 d(4) is not changed 6

Choose Minimum Temporary Label

Update d(6) is not updated

Choose Minimum Temporary Label There is nothing to update

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

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

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

Update Step       1

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

Update Step    

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

Update  

Choose Minimum Temporary Label   6 45

Update  

Choose Minimum Temporary Label

Update

Choose Minimum Temporary Label There is nothing to update

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

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