Shortest Route Problems

Slides:



Advertisements
Similar presentations
Bellman-Ford algorithm
Advertisements

Chapter 9: Graphs Shortest Paths
Chen, Lu Mentor: Zhou, Jian Shanghai University, School of Management Chen213.shu.edu.cn.
The Greedy Approach Chapter 8. The Greedy Approach It’s a design technique for solving optimization problems Based on finding optimal local solutions.
Design and Analysis of Algorithms Single-source shortest paths, all-pairs shortest paths Haidong Xue Summer 2012, at GSU.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
1 Section 9.4 Spanning Trees. 2 Let G be a simple graph. A spanning subtree of G is a subgraph of G containing every vertex of G –must be connected; contains.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
Excursions in Modern Mathematics(Tannenbaum) and Thinking Mathematically (Blitzer)
Management Science 461 Lecture 2b – Shortest Paths September 16, 2008.
CSC 213 Lecture 23: Shortest Path Algorithms. Weighted Graphs Each edge in weighted graph has numerical weight Weights can be distances, building costs,
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
Chapter 4 Graphs.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
The Shortest Path Problem
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
GRAPH Learning Outcomes Students should be able to:
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 Path Algorithm This is called “Dijkstra’s Algorithm” …pronounced “Dirk-stra”
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.
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.
Graph Theory Hamilton Paths and Hamilton Circuits.
Spring 2015 Mathematics in Management Science Network Problems Networks & Trees Minimum Networks Spanning Trees Minimum Spanning Trees.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
The Travelling Salesperson Problem A salesperson needs to visit London, Nottingham, Manchester and Leeds, he lives in Birmingham. Find the shortest route.
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Walks, Paths and Circuits. A graph is a connected graph if it is possible to travel from one vertex to any other vertex by moving along successive edges.
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)
Today we will… Identify the vertices and edges on a given shape.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
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.
Limitation of Computation Power – P, NP, and NP-complete
Hamilton Paths and Hamilton Circuits
Weighted Graphs and traveling Salesperson problem
EECS 203 Lecture 19 Graphs.
Shortest Path Problems
Redraw these graphs so that none of the line intersect except at the vertices B C D E F G H.
Shortest Path from G to C Using Dijkstra’s Algorithm
EECS 203 Lecture 20 More Graphs.
Graph Theory.
Graphs Chapter 13.
Decision Maths Dijkstra’s Algorithm.
Shortest Path.
Shortest Path.
Shortest Path Algorithms
A path that uses every vertex of the graph exactly once.
Shortest path algorithm
Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex.
Nearest Neighbor Repetitive Nearest Neighbor (Unit 10) SOL: DM.2
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Shortest Path.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Euler circuit Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit,
Traveling Salesman Problems Nearest Neighbor Method
Chapter 9: Graphs Shortest Paths
Presentation transcript:

Shortest Route Problems

Traveling Salesperson Problem The traveling salesperson problem asks that a Hamiltonian circuit of least total weight be found for a graph. But what if you don’t need to visit every vertex but instead needed only to find the shortest route from one vertex to another? An efficient method for solving this type of problem does exist, an algorithm attributed to E. W. Dijkstra.

Edsger W. Dijkstra E. W. Dijkstra was born in the Netherlands in 1930. He is considered to be one of the original theorists of modern computer science. He first published his algorithm about the shortest path algorithm in a German journal in 1959.

Shortest Path Algorithm This is a modification of Dijkstra’s algorithm: Label the starting vertex S and circle it. Examine all edged that have S as an endpoint. Darken the edge with the shortest length and circle the vertex at the other endpoint of the darkened edge. Examine all uncircled vertices that are adjacent to the circled vertices in the graph.

Algorithm (cont’d) Using only circled vertices and darkened edges between the vertices that are circled, find the lengths of all paths from S to each vertex being examined. Choose the vertex and edge that yield the shortest path. Circle this vertex and darken this edge. Ties are broken arbitrarily. Repeat Steps 2 and 3 until all vertices are circled. The darkened edges of the graph form the shortest routes from S to every other vertex in the graph.

Example Use the shortest path algorithm to find the shortest path form A to F in the graph. C 6 E 2 3 4 5 A 2 F 5 4 3 B D

Using the Algorithm To find the solution to this problem, begin by circling vertex A and labeling it S. Examine all vertices that are adjacent to S. Adjacent Vertices Path from S to Vertex Length of Path Adjacent to S B SB 5 C SC 2 1. Circle C, darken the edge SC. Adjacent to C SCB 4 E SCE 8 D SCD 6 continued

Example Adjacent Vertices Path from S to Vertex Length of Path 2. Circle B, darken edge CB. Adjacent to C E SCE 8 D SCD 6 Adjacent to B SCBD 7 3. Circle D, darken edge CD. Adjacent to D SCDE 11 F SCDF 10 4. Circle E, darken edge CE Adjacent to E SCEF 5. Circle F, darken edge DF

Shortest Route The shortest route from A to F is A, C, D, F and the length is 10. The darkened edges show the shortest routes from A to the other vertices in the graph.

Graph Step 4 C 6 E 2 3 4 5 A 2 F S 5 4 3 B D Step 1 Step 5 Step 2

Practice Problems Use the shortest path algorithm to find the shortest route from A to F. A D 2 3 8 2 F 5 6 1 C 8 3 B E

Practice Problems (cont’d) Use the shortest path algorithm to determine the shortest distance from S to each of the other vertices. M 3 2 N 2 1 S J 1 5 2 4 L 3 K