Chapter 24: Single-Source Shortest Paths

Slides:



Advertisements
Similar presentations
Single Source Shortest Paths
Advertisements

* Bellman-Ford: single-source shortest distance * O(VE) for graphs with negative edges * Detects negative weight cycles * Floyd-Warshall: All pairs shortest.
October 31, Algorithms and Data Structures Lecture XIII Simonas Šaltenis Nykredit Center for Database Research Aalborg University
CS138A Single Source Shortest Paths Peter Schröder.
 2004 SDU Lecture9- Single-Source Shortest Paths 1.Related Notions and Variants of Shortest Paths Problems 2.Properties of Shortest Paths and Relaxation.
Data Structures and Algorithms Graphs Single-Source Shortest Paths (Dijkstra’s Algorithm) PLSD210(ii)
chapter Single-Source Shortest Paths Problem Definition Shortest paths and Relaxation Dijkstra’s algorithm (can be viewed as a greedy algorithm)
Jim Anderson Comp 122, Fall 2003 Single-source SPs - 1 Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph.
Shortest Path Problems
Shortest Paths Definitions Single Source Algorithms –Bellman Ford –DAG shortest path algorithm –Dijkstra All Pairs Algorithms –Using Single Source Algorithms.
1 8-ShortestPaths Shortest Paths in a Graph Fundamental Algorithms.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 15 Shortest paths algorithms Properties of shortest paths Bellman-Ford algorithm.
Shortest Paths Definitions Single Source Algorithms
CSE 780 Algorithms Advanced Algorithms SSSP Dijkstra’s algorithm SSSP in DAGs.
1 Graph Algorithms Single source shortest paths problem Dana Shapira.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 15 Shortest paths algorithms Properties of shortest paths Bellman-Ford algorithm.
Theory of Computing Lecture 7 MAS 714 Hartmut Klauck.
Jim Anderson Comp 122, Fall 2003 Single-source SPs - 1 Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Graph (II) Shortest path, Minimum spanning tree GGuy
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 10.
Chapter 24: Single-Source Shortest Paths Given: A single source vertex in a weighted, directed graph. Want to compute a shortest path for each possible.
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
Lecture 13 Algorithm Analysis
Single-Source Shortest Paths (25/24) HW: 25-2 and 25-3 p. 546/24-2 and 24-3 p.615 Given a graph G=(V,E) and w: E   weight of is w(p) =  w(v[i],v[i+1])
Data Structures and Algorithms I Day 19, 11/3/11 Edge-Weighted Graphs
Shortest Paths and Minimum Spanning Trees
CSC317 Shortest path algorithms
Graph Algorithms BFS, DFS, Dijkstra’s.
COMP 6/4030 ALGORITHMS Prim’s Theorem 10/26/2000.
Algorithms and Data Structures Lecture XIII
Minimum Spanning Tree Shortest Paths
Introduction to Graphs
Minimum Spanning Trees
SINGLE-SOURCE SHORTEST PATHS
Elementary graph algorithms Chapter 22
CSCE 411 Design and Analysis of Algorithms
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Page 620 Single-Source Shortest Paths
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
2018/12/27 chapter25.
Advanced Algorithms Analysis and Design
Lecture 11 Topics Application of BFS Shortest Path
Algorithms and Data Structures Lecture XIII
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Shortest Paths and Minimum Spanning Trees
CSC 413/513: Intro to Algorithms
Lecture 13 Algorithm Analysis
CSCE 411 Design and Analysis of Algorithms
Lecture 13 Algorithm Analysis
Shortest Path Problems
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
The Bellman-Ford Shortest Path Algorithm Neil Tang 03/27/2008
Chapter 24: Single-Source Shortest Paths
Autumn 2016 Lecture 10 Minimum Spanning Trees
Advanced Algorithms Analysis and Design
CSE 417: Algorithms and Computational Complexity
Elementary graph algorithms Chapter 22
Negative-Weight edges:
Negative-Weight edges:
Bellman Ford.
CS 3013: DS & Algorithms Shortest Paths.
Winter 2019 Lecture 10 Minimum Spanning Trees
Chapter 24: Single-Source Shortest-Path
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Topological Sorting Minimum Spanning Trees Shortest Path
Advanced Algorithms Analysis and Design
Presentation transcript:

Chapter 24: Single-Source Shortest Paths Input: - Directed graph G(V,E). - Weight (‘length’) function w: E  R. Notions: Weight/length of a directed path. Shortest path from u to v, denoted DELTA(u,v): length of minimum weight/length path from u to v. Other variants: Single-source shortest paths All-pair shortest paths

Observations Subpaths of shortest paths are shortest path Can a shortest path contain a cycle? Answer: Neither negative nor positive length

Representation of shortest path Weighted directed graph. Nodes show shortest path from s. Shaded edges: shortest path tree rooted at s. Another shortest path tree.

The two case: Does edge uv relax d(v)? d(v) shortest distance from s to v based on ‘current knowledge’ Growth of ‘current knowledge’ from one step of an algorithm to the next: key difference between algorithms

Bellman-Ford algorithm Initialize d(s)  0; all other v in V: d(v)  ‘infinity |V|-1 rounds: For every edge u v: RELAX(U,V) Do the same in round |V|. If any change: return FALSE Inductive claim: If shortest simple path from s to v has i edges then following round i d(v) <= DELTA(s,v) Complexity: O(|E| |V|)

Single/all source shortest/longest paths in DAGs PERT graphs: important in operations research, compiler One variant: - Start with vertices who in-degree is 0. Peel and relax. Repeat. Note: topological sort is redundant. Similar point to 22.4

Dijkstra’s algorithm All edge weights are non-negative. d(s) is final distance of s. RELAX all edges su for all u. v – the vertex whose d(s) is minimum over {u: d(u) not finalized}; finalize d(v); RELAX vu for all u.

Correctness proof of Dijkstra’s algorithm Inductive Claim: Following iteration i, d(v) = DELTA(s,v) for every vertex v whose d(v) was finalized by the end of iteration i. Sketch of proof: Assume the inductive claims for i-1. Suppose that d(u) is finalized in iteration i , but there is a path (e.g., p2 in figure) from s to u, which is shorter than all paths restricted to previously finalized nodes (set S in figure) plus u. Let y be the first node in p2 outside S; but d(y) must be < d(u) at the time that u was picked as minimum outside S. A contradiction.

Complexity of Dijktra’s algorithm O(|E|) DECREASE-KEY queries and O(|V|) EXTRACT-MIN queries lead to O((|E|+|V|) log |V|) time. Can be improved to to O(|E|+|V| log |V|) time.