Shortest Path Problems

Slides:



Advertisements
Similar presentations
Bellman-Ford algorithm
Advertisements

Decision Maths Dijkstra’s Algorithm.
Shortest Paths Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 9.6 Based on slides from Chuck Allison, Michael T.
Discrete Math for Computer Science. Mathematical Model Real-world Problem Computerized Solution Abstract Model Transformed Model picture of the real worldpicture.
Design and Analysis of Algorithms Single-source shortest paths, all-pairs shortest paths Haidong Xue Summer 2012, at GSU.
Breadth-First Search Seminar – Networking Algorithms CS and EE Dept. Lulea University of Technology 27 Jan Mohammad Reza Akhavan.
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
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
Shortest path algorithm. Introduction 4 The graphs we have seen so far have edges that are unweighted. 4 Many graph situations involve weighted edges.
Graphs Chapter 28 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Dijkstra’s Algorithm Slide Courtesy: Uwash, UT 1.
The Shortest Path Problem
Shortest Path Problems Dijkstra’s Algorithm TAT ’01 Michelle Wang.
Dijkstra's algorithm.
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
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 Paths and Dijkstra’s Algorithm CS 105. SSSP Slide 2 Single-source shortest paths Given a weighted graph G and a source vertex v in G, determine.
D IJKSTRA ' S ALGORITHM. S INGLE -S OURCE S HORTEST P ATH P ROBLEM Single-Source Shortest Path Problem - The problem of finding shortest paths from a.
Shortest Path Problems Dijkstra’s Algorithm. Introduction Many problems can be modeled using graphs with weights assigned to their edges: Airline flight.
Liskeard Launceston Callington St Austell Bodmin Starter Find the quickest route from St Austell to Launceston.
Shortest Paths Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 8.6 Based on slides from Chuck Allison, Michael T.
Introduction to Algorithms All-Pairs Shortest Paths My T. UF.
Graphs Chapter 28 © 2015 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures and Abstractions with Java, 4e Frank Carrano.
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali :
A Introduction to Computing II Lecture 16: Dijkstra’s Algorithm Fall Session 2000.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Shortest Path Dr. Yasir. Weighted Graphs In many applications, each edge of a graph has an associated numerical value, called a weight. Usually, the edge.
Weighted Graphs and traveling Salesperson problem
Shortest Path Problems
Graph theory. Graph theory Leonard Euler (“Oiler”)
Chapter 7: Greedy Algorithms
Comp 245 Data Structures Graphs.
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Discrete Mathematics and Its Applications (5th Edition)
Minimum Spanning Tree Neil Tang 3/25/2010
Connected Components Minimum Spanning Tree
Decision Maths Dijkstra’s Algorithm.
15.082J & 6.855J & ESD.78J Visualizations
Shortest Path.
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Analysis and design of algorithm
CSE 373: Data Structures and Algorithms
4-4 Graph Theory Trees.
Lecture 24 CSE 331 Oct 25, 2013.
Warm Up – Friday.
Lecture 23 CSE 331 Oct 24, 2011.
Dijkstra’s Shortest Path Algorithm Neil Tang 03/25/2008
Graph Theory By Amy C. and John M..
Discrete Mathematics and Its Applications (5th Edition)
Minimum Spanning Tree Neil Tang 4/3/2008
Slide Courtesy: Uwash, UT
Networks Kruskal’s Algorithm
Graph Theory I In today’s lesson we will look at:
Shortest Path Algorithm for Weighted Non-negative Undirected Graphs
Weighted Graphs & Shortest Paths
Dijkstra’s Shortest Path Algorithm Neil Tang 3/2/2010
CSE 373 Data Structures and Algorithms
and 6.855J Dijkstra’s Algorithm
Slide Courtesy: Uwash, UT
Visualizations Dijkstra’s Algorithm
Dijkstra's Shortest Path Algorithm
Shortest Paths Discrete Mathematics and Its Applications (8th Edition)
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Graphs G = (V,E) V is the vertex set.
Shortest Route Problems
Chapter 9 Graph algorithms
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
15.082J & 6.855J & ESD.78J Visualizations
Presentation transcript:

Shortest Path Problems

Introduction Many problems can be modeled using graphs with weights assigned to their edges: Airline flight times Telephone communication costs Computer networks response times

Where’s my motivation? Fastest way to get to school by car Finding the cheapest flight home How much wood could a woodchuck chuck if a woodchuck could chuck wood?

Optimal driving time UCLA The Red Garter the beach (dude) In N’ Out 25 The Red Garter 19 5 9 the beach (dude) 21 16 31 In N’ Out 36 My cardboard box on Sunset

Tokyo Subway Map

Applications - Maps (Map Quest, Google Maps) - Routing Systems

Dijkstra's algorithm Steps: 1) Choose/given a starting point. A solution to the single-source shortest path problem in graph theory.    Works on both directed and undirected graphs. Steps: 1) Choose/given a starting point. 2) Find the shortest path to the next vertex – label the vertex. 3) Label the remaining vertices from the shortest vertex. 4) Systematically check each vertex to be sure that they are labelled correctly.

Using the previous example, we will find the shortest path from a to c. 25 r 19 9 5 b 16 21 31 i 36 c

(a) = 0 25 (r) = 19 9 5 (b) = 16 21 31 (i) = 36 (c) =

(a) = 0 25 (r) = 19 9 5 (b) = 19 16 21 31 (i) = 36 (c) =

(a) = 0 25 (r) = 19 9 5 (b) = 19 16 21 31 (i) = 35 36 (c) =

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 35 36 (c) =

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 35 36 (c) = 50

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 9 36 (c) = 50

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 9 36 (c) = 50

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 9 36 (c) = 45

(a) = 0 25 (r) = 24 19 9 5 (b) = 19 16 21 31 (i) = 9 36 (c) = 45

Example ∞ Distance(source) = 0 Distance (all vertices but source) = ∞ ∞ Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E ∞ ∞ ∞ 5 8 4 6 F 1 G ∞ ∞ Pick vertex in List with minimum distance.

Example: Initialization ∞ Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E ∞ ∞ 1 5 8 4 6 F 1 G ∞ ∞

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E ∞ ∞ 1 5 8 4 6 F 1 G ∞ ∞

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E ∞ 3 1 5 8 4 6 F 1 G ∞ ∞

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E 3 3 1 5 8 4 6 F 1 G ∞ ∞

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E 3 3 1 5 8 4 6 F 1 G 9 ∞

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E 3 3 1 5 8 4 6 F 1 G 9 5

Example 2 Distance(source) = 0 Distance (all vertices but source) = ∞ 2 Distance(source) = 0 Distance (all vertices but source) = ∞ A 2 B 4 1 3 10 C 2 D 2 E 3 3 1 5 8 4 6 F 1 G 6 5