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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
Michael Ghoorchian. Edsger W. Dijkstra ( ) Dutch Computer Scientist Received Turing Award for contribution to developing programming languages.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
D IJKSTRA ' S ALGORITHM By Laksman Veeravagu and Luis Barrera Edited by: Manuela Caicedo, Francisco Morales, Rafael Feliciano, and Carlos Jimenez.
Shortest Paths and Dijkstra's Algorithm CS 110: Data Structures and Algorithms First Semester,
Dijkstra’s Algorithm MARLEY CANTRELL. About Dijkstra Dutch computer scientist Father was a Chemist, mother was a mathematician Received Turing Award for.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Shortest path algorithm. Introduction 4 The graphs we have seen so far have edges that are unweighted. 4 Many graph situations involve weighted edges.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Dijkstra’s Algorithm Slide Courtesy: Uwash, UT 1.
The Shortest Path Problem
D IJKSTRA ' S ALGORITHM By Laksman Veeravagu and Luis Barrera.
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
Dijkstra's algorithm.
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Dijkstra's algorithm CS3240. The author: Edsger Wybe Dijkstra "Computer Science is no more about computers than astronomy is about telescopes."
EECS 203: It’s the end of the class and I feel fine. Graphs.
Dr. Naveed Ahmad Assistant Professor Department of Computer Science University of Peshawar.
COSC 2007 Data Structures II Chapter 14 Graphs III.
Shortest Path Problem Weight of the graph –Nonnegative real number assigned to the edges connecting to vertices Weighted graphs –When a graph.
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.
Shortest Path in Weighted Graph : Dijkstra’s Algorithm.
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.
Kruskal’s and Dijkstra’s Algorithm.  Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted.
Shortest Path Algorithms. Definitions Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source.
1 Dijkstra’s Algorithm Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
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.
1 Introduction to Algorithms L ECTURE 17 (Chap. 24) Shortest paths I 24.2 Single-source shortest paths 24.3 Dijkstra’s algorithm Edsger Wybe Dijkstra
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
1 Single-source shortest path Shortest Path Given a weighted directed graph, one common problem is finding the shortest path between two given vertices.
Limitation of Computation Power – P, NP, and NP-complete
By Laksman Veeravagu and Luis Barrera
Shortest Path Problems
COMP108 Algorithmic Foundations Greedy methods
Lecture 13 Shortest Path.
Shortest Path Problems
I206: Lecture 15: Graphs Marti Hearst Spring 2012.
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Discrete Mathematics and Its Applications (5th Edition)
Graph Theory.
Foundations of Discrete Mathematics
Decision Maths Dijkstra’s Algorithm.
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Analysis and design of algorithm
Shortest-Paths Trees Kun-Mao Chao (趙坤茂)
Shortest Path Problems
Shortest Path Problems
Shortest Path Algorithms
Based on slides of Dan Suciu
Discrete Mathematics and Its Applications (5th Edition)
Slide Courtesy: Uwash, UT
Shortest Path Problems
Slide Courtesy: Uwash, UT
Graph Algorithms: Shortest Path
Shortest path problem and its application to optical network
CSE 417: Algorithms and Computational Complexity
Shortest Paths Discrete Mathematics and Its Applications (8th Edition)
Graphs: Shortest path and mst
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Shortest Route Problems
Chapter 9 Graph algorithms
Shortest Paths Discrete Mathematics and Its Applications (7th Edition)
Presentation transcript:

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 weights are nonnegative integers. Weighted graphs may be either directed or undirected. The weight of an edge is often referred to as the "cost" of the edge. In applications, the weight may be a measure of the length of a route, the capacity of a line, the energy required to move between locations along a route, etc.

Weight of edges can represent everything in real world, e.g amount of money to be transferred from one account to an other account can be positive or negative, Think of a driver, who gets paid to drive his employer from s to t but he pays between a and b (say travelling between his home and his workplace). Weighted Graphs

Shortest Path Given a weighted graph, and a designated node S, we would like to find a path of least total weight from S to each of the other vertices in the graph. The total weight of a path is the sum of the weights of its edges.

Single-Source Shortest Path Problem The problem of finding shortest paths from a source vertex v to all other vertices in the graph.

Applications Traffic Information Systems are most prominent use - Mapping (Map Quest, Google Maps) - Routing Systems

Dijkstra's Algorithm is a solution to the single-source shortest path problem in graph theory. Works on both directed and undirected graphs. However, all edges must have nonnegative weights. Approach: Greedy Input: Weighted graph G={E,V} and source vertex v ∈ V, such that all edge weights are nonnegative. Output: Lengths of shortest paths (or the shortest paths themselves) from a given source vertex v ∈ V to all other vertices. Complexity: |E| log |V| A greedy algorithm is a mathematical process that looks for simple, easy-to-implement solutions to complex, multi-step problems by deciding which next step will provide the most obvious benefit.

Edsger Wybe Dijkstra May 11, 1930 – August 6, Received the 1972 A. M. Turing Award, widely considered the most prestigious award in computer science. - The Schlumberger Centennial Chair of Computer Sciences at The University of Texas at Austin from 1984 until Made a strong case against use of the GOTO statement in programming languages and helped lead to its deprecation. - Known for his many essays on programming.

Dijkstra's Algorithm – Main Idea The idea is to visit the nodes in order of their closeness to source vertex s. The closest node to s, say x, must be adjacent to s and the next closest be either adjacent to s or x. The third closest node to s must be either adjacent to s or x or y, and so on.

Relaxation

Dijkstra's Algorithm – Working

Initialize: Dijkstra's Algorithm – Working 0

d Blue shows the relaxation process

c Dijkstra's Algorithm – Working

Red shows that these vertices are visited and decision has been made

Dijkstra's Algorithm – Working

ce bdf

ce bdf

ce bdf Yellow line represent that this edge is of no more use.

ce bdf Dijkstra's Algorithm – Working

ce bdf

ce bdf

ce bdf

ce bdf

ce bdfg