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.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Weighted graphs Example Consider the following graph, where nodes represent cities, and edges show if there is a direct flight between each pair of cities.
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
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.
1Other Network ModelsLesson 6 LECTURE SIX Other Network Models.
1 Network Models Chapter 4 2 For a given network find the path of minimum distance, time, or cost from a starting point, the start node, to a destination,
The Greedy Approach Chapter 8. The Greedy Approach It’s a design technique for solving optimization problems Based on finding optimal local solutions.
1 The TSP : Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell ( )
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
1 Chapter 15.3 Hamilton Paths and Hamilton Circuits Objectives 1.Understand the definitions of Hamilton paths & Hamilton circuits. 2.Find the number of.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
ITEC200 – Week 12 Graphs. 2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study.
1 Processing & Analysis of Geometric Shapes Shortest path problems Shortest path problems The discrete way © Alexander & Michael Bronstein, ©
Applied Discrete Mathematics Week 12: Trees
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lectures 3 Tuesday, 9/25/01 Graph Algorithms: Part 1 Shortest.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Chapter 9: Greedy Algorithms The Design and Analysis of Algorithms.
The Theory of NP-Completeness
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
A traveling salesman has customers in 5 cities which we will call A, B, C, D, and E. The salesman needs to travel to all 5 cities with his trip starting.
Euler and Hamilton Paths
The Shortest Path Problem
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Ch. 11: Optimization and Search Stephen Marsland, Machine Learning: An Algorithmic Perspective. CRC 2009 some slides from Stephen Marsland, some images.
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
May 5, 2015Applied Discrete Mathematics Week 13: Boolean Algebra 1 Dijkstra’s Algorithm procedure Dijkstra(G: weighted connected simple graph with vertices.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Graph Algorithms: Minimum.
1 Abstract Data Type We have discussed: List Tree Today we will talk about Graph.
1 Network Models Chapter 4 2 For a given network find the path of minimum distance, time, or cost from a starting point, the start node, to a destination,
A Shortest Path Algorithm. Motivation Given a connected, positive weighted graph Find the length of a shortest path from vertex a to vertex z.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
EECS 203: It’s the end of the class and I feel fine. Graphs.
1 The TSP : NP-Completeness Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell.
Problem Solving with Networks 18/08/2012 Jamie Sneddon
Graph Theory Hamilton Paths and Hamilton Circuits.
May 1, 2002Applied Discrete Mathematics Week 13: Graphs and Trees 1News CSEMS Scholarships for CS and Math students (US citizens only) $3,125 per year.
Euler and Hamilton Paths
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
Data Structures & Algorithms Graphs
NPC.
CHAPTER 13 GRAPH ALGORITHMS ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i,
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.
Excursions in Modern Mathematics Sixth Edition
EECS 203 Lecture 19 Graphs.
Shortest Path Problems
Agenda Lecture Content: Introduction to Graph Path and Cycle
EECS 203 Lecture 20 More Graphs.
Discrete Maths 9. Graphs Objective
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Discrete Mathematics and Its Applications (5th Edition)
Foundations of Discrete Mathematics
Shortest Path.
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Shortest Path Algorithms
Discrete Mathematics and Its Applications (5th Edition)
Discrete Mathematics and Its Applications (5th Edition)
Shortest Paths Discrete Mathematics and Its Applications (8th Edition)
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Discrete Mathematics and Its Applications (5th Edition)
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Presentation transcript:

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. Goodrich, and Roberto Tamassia By Longin Jan Latecki

Weighted Graphs Graphs that have a number assigned to each edge are called weighted graphs. SF LA DEN CHI ATL MIA BOS NY

Weighted Graphs SF LA DEN CHI ATL MIA BOS NY MILES

Weighted Graphs SF LA DEN CHI ATL MIA BOS NY FARES $129 $99 $79 $59 $89 $69 $129 $89 $39 $99 $79 $69 $39

Weighted Graphs SF LA DEN CHI ATL MIA BOS NY 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

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. Dijkstra’s Algorithm finds the shortest path between two vertices.

Dijkstra's Algorithm

Dijkstra Animation Demo

Problem: shortest path from a to z a bd f z ceg abcdefgzS 0∞∞∞∞∞∞∞a x4(a)3(a)∞∞∞∞∞a,c xx

processed: fromNode: distance: # 20 # # index: IndexOfMin

processed: fromNode: distance: # 20 # # index: Unprocessed node adjacent to 2 is 4. # > = 55 so replace # with

processed: fromNode: distance: # # index: IndexOfMin

processed: fromNode: distance: # # index: IndexOfMin Unprocessed node adjacent to 5 is > = 30 so replace 35 with

processed: fromNode: distance: # # index: IndexOfMin Unprocessed node adjacent to 5 is 6. # > = 70 so replace # with

processed: fromNode: distance: # index: IndexOfMin Unprocessed node adjacent to 5 is 7. # > = 95 so replace # with

processed: fromNode: distance: index: IndexOfMin

processed: fromNode: distance: index: IndexOfMin Unprocessed node adjacent to 3 is < = 65 no change in array

processed: fromNode: distance: index: IndexOfMin

processed: fromNode: distance: index: IndexOfMin Unprocessed node adjacent to 4 is > = 65 so replace 70 with 65

processed: fromNode: distance: index: IndexOfMin

processed: fromNode: distance: index: IndexOfMin

processed: fromNode: distance: index: IndexOfMin Unprocessed node adjacent to 6 is > = 80 so replace 95 with 80

processed: fromNode: distance: index: IndexOfMin

processed: fromNode: distance: index: IndexOfMin All nodes have been processed Algorithm finishes.

Theorems Dijkstra’s algorithm finds the length of a shortest path between two vertices in a connected simple undirected weighted graph G=(V,E). The time required by Dijkstra's algorithm is O(|V| 2 ). It will be reduced to O(|E|log|V|) if heap is used to keep {v  V\S i : L(v) <  }, where S i is the set S after iteration i.

The Traveling Salesman Problem The traveling salesman problem is one of the classical problems in computer science. A traveling salesman wants to visit a number of cities and then return to his starting point. Of course he wants to save time and energy, so he wants to determine the shortest cycle for his trip. We can represent the cities and the distances between them by a weighted, complete, undirected graph. The problem then is to find the shortest cycle (of minimum total weight that visits each vertex exactly one). Finding the shortest cycle is different than Dijkstra’s shortest path. It is much harder too, no polynomial time algorithm exists!

The Traveling Salesman Problem Importance: Variety of scheduling application can be solved as a traveling salesmen problem. Examples : Ordering drill position on a drill press. School bus routing. The problem has theoretical importance because it represents a class of difficult problems known as NP- hard problems.

THE FEDERAL EMERGENCY MANAGEMENT AGENCY A visit must be made to four local offices of FEMA, going out from and returning to the same main office in Northridge, Southern California.

FEMA traveling salesman Network representation

Home

FEMA - Traveling Salesman Solution approaches –Enumeration of all possible cycles. This results in (m-1)! cycles to enumerate for a graph with m nodes. Only small problems can be solved with this approach.

Possible cycles CycleTotal Cost 1. H-O1-O2-O3-O4-H H-O1-O2-O4-O3-H H-O1-O3-O2-O3-H H-O1-O3-O4-O2-H H-O1-O4-O2-O3-H H-O1-O4-O3-O2-H H-O2-O3-O1-O4-H H-O2-O1-O3-O4-H H-O2-O4-O1-O3-H H-O2-O1-O4-O3-H H-O3-O1-O2-O4-H H-O3-O1-O2-O4-H260 Minimum For this problem we have (5-1)! / 2 = 12 cycles. Symmetrical problems need to enumerate only (m-1)! / 2 cycles. FEMA – full enumeration

Home FEMA – optimal solution

The Traveling Salesman Problem Unfortunately, no algorithm solving the traveling salesman problem with polynomial worst-case time complexity has been devised yet. This means that for large numbers of vertices, solving the traveling salesman problem is impractical. In these cases, we can use efficient approximation algorithms that determine a path whose length may be slightly larger than the traveling salesman’s path, but