Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro.

Slides:



Advertisements
Similar presentations
© DEEDS 2008Graph Algorithms1 Remarks on Dijkstra  Determining the minimum marginal element (code line: v = the vertex in M 2 with minimum v.L; ) accounts.
Advertisements

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.
Shortest-paths. p2. Shortest-paths problems : G=(V,E) : weighted, directed graph w : E  R : weight function P=
 2004 SDU Lecture9- Single-Source Shortest Paths 1.Related Notions and Variants of Shortest Paths Problems 2.Properties of Shortest Paths and Relaxation.
Single-Source Shortest- paths. p2. Shortest-paths problems : G=(V,E) : weighted, directed graph w : E  R : weight function P=
chapter Single-Source Shortest Paths Problem Definition Shortest paths and Relaxation Dijkstra’s algorithm (can be viewed as a greedy algorithm)
Theory of Computing Lecture 8 MAS 714 Hartmut Klauck.
Length of a Path The weight (length) of a path is the sum of the weights of its edges. adcbe Path p: Edge weights: w(a, b) = 7, w(b, c) = 2, w(c,
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro.
All Pairs Shortest Paths and Floyd-Warshall Algorithm CLRS 25.2
Tirgul 12 Algorithm for Single-Source-Shortest-Paths (s-s-s-p) Problem Application of s-s-s-p for Solving a System of Difference Constraints.
CS420 lecture twelve Shortest Paths wim bohm cs csu.
CSE 780 Algorithms Advanced Algorithms Shortest path Shortest path tree Relaxation Bellman-Ford Alg.
Lecture 20: Shortest Paths Shang-Hua Teng. Weighted Directed Graphs Weight on edges for distance
Lecture 19: Shortest Paths Shang-Hua Teng. Weighted Directed Graphs Weight on edges for distance
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.
Graph Algorithms Shortest path problems [Adapted from K.Wayne]
BellmanFord. BellmanFord(G,w,s) 1 InitializeSingleSource(G,s) 2 for i 1 to |V[G]| do for each (u,v) E[G] 4 do Relax(u,v,w) 5 for each edge (u,v)
Shortest Paths Definitions Single Source Algorithms
Analysis of Algorithms CS 477/677 Shortest Paths Instructor: George Bebis Chapter 24.
1 Graph Algorithms Single source shortest paths problem Dana Shapira.
DAST 2005 Tirgul 13 (and more) sample questions. DAST 2005 (back to previous week) We’ve seen that solving the shortest paths problem requires O(VE) time.
Lecture 8 Shortest Path Shortest-path problems
CS 253: Algorithms Chapter 24 Shortest Paths Credit: Dr. George Bebis.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 15 Shortest paths algorithms Properties of shortest paths Bellman-Ford algorithm.
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS. Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the.
Topological Sorting and Least-cost Path Algorithms.
Graphs – Shortest Path (Weighted Graph) ORD DFW SFO LAX
David Luebke 1 9/10/2015 ITCS 6114 Single-Source Shortest Path.
CISC 235: Topic 11 Shortest Paths Algorithms. CISC 235 Topic 112 Outline Single-Source Shortest Paths Algorithm for Unweighted Graphs Algorithm for Weighted,
David Luebke 1 9/13/2015 CS 332: Algorithms S-S Shortest Path: Dijkstra’s Algorithm Disjoint-Set Union Amortized Analysis.
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.
Graph Algorithms Shortest path problems. Graph Algorithms Shortest path problems.
1 Shortest Path Problems How can we find the shortest route between two points on a road map? Model the problem as a graph problem: –Road map is a weighted.
Algorithm Course Dr. Aref Rashad February Algorithms Course..... Dr. Aref Rashad Part: 6 Shortest Path Algorithms.
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Prof. Sumanta Guha Slide Sources: CLRS “Intro.
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.
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Prof. Sumanta Guha Slide Sources: CLRS “Intro.
Master Method (4. 3) Recurrent formula T(n) = a  T(n/b) + f(n) 1) if for some  > 0 then 2) if then 3) if for some  > 0 and a  f(n/b)  c  f(n) for.
Introduction to Algorithms Jiafen Liu Sept
The single-source shortest path problem (SSSP) input: a graph G = (V, E) with edge weights, and a specific source node s. goal: find a minimum weight (shortest)
Algorithms LECTURE 14 Shortest Paths II Bellman-Ford algorithm
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
Shortest Path Algorithms. Definitions Variants  Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source.
Lecture 13 Algorithm Analysis
Greedy Algorithms Z. GuoUNC Chapel Hill CLRS CH. 16, 23, & 24.
Introduction to Algorithms All-Pairs Shortest Paths My T. UF.
Single Source Shortest Paths Chapter 24 CSc 4520/6520 Fall 2013 Slides adapted from George Bebis, University of Reno, Nevada.
Shortest paths Given: A single source vertex (given s) in a weighted, directed graph. Want to compute a shortest path for each possible destination. (Single.
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 (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Prof. Sumanta Guha Slide Sources: CLRS “Intro.
David Luebke 1 11/21/2016 CS 332: Algorithms Minimum Spanning Tree Shortest Paths.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Shortest Path Problems
CS 3013: DS & Algorithms Shortest Paths.
Advanced Algorithms Analysis and Design
Presentation transcript:

Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro. To Algorithms” book website (copyright McGraw Hill) adapted and supplemented

CLRS “Intro. To Algorithms” Ch. 24: Single-Source Shortest Paths

The shortest-path weight from s to v is denoted δ(s,v)

Π(v) is the predecessor of v in the shortest path to v.

Properties of shortest paths and relaxation Triangle inequality: for any edge (u,v)  E, we have δ(s,v)  δ(s,u) + w(u,v). Upper bound property: We always have d[v] ≥ δ(s,v) for all vertices v  V, and once d[v] achieves the value δ(s,v), it never changes (even with further relaxations). No-path property: If there is no path from s to v, then we always have d[v] = δ(s,v) = . Convergence property: If s …  u  v is a shortest path in G for some u, v  V, and if d[u] = δ(s,u) at any time prior to relaxing edge (u,v), then d[v] = δ(s,v) at all times afterwards. Path relaxation property: If p = (v 0, v 1, …, v k ) is a shortest path from s = v 0 to v k, and the edges of p are relaxed in the order (v 0,v 1 ), (v 1,v 2 ), …, (v k-1,v k ), then d[v k ] = δ(s,v k ). This property holds regardless of any other relaxation steps that occur, even if they are intermixed with relaxations of the edges of p. Predecessor-subgraph property: Once d[v] = δ(s,v) for all v  V, the predecessor subgraph is a shortest paths tree rooted at s. (In fact, if there is no negative-weight cycle reachable from s then the predecessor subgraph is always a tree rooted at s.)

If there is no negative edge weight cycle reachable from s then Bellman-Ford returns TRUE and d[v] = δ(s,v) for every vertex v. If there is a negative edge weight cycle reachable from s then Bellman-Ford returns FALSE. Running time:  (|V||E|)

// all edge weights are assumed non-negative

Proof that Dijkstra is correct

x 1 – x 2 ≤ 0, x 1 – x 5 ≤ -1, x 2 – x 5 ≤ 1, x 3 – x 1 ≤ 5, x 4 – x 1 ≤ 4, x 4 – x 3 ≤ -1, x 5 – x 3 ≤ -3, x 5 – x 4 ≤ -3. Th. 24.9: Given a system Ax ≤ b of difference equations, let G = (V, E) be the corresponding constraint graph. If G contains no negative-weight cycles, then x = ( δ(v 0, v 1 ), δ(v 0, v 2 ), …, δ(v 0, v k ) ) is a feasible solution for the system. If G contains a negative-weight cycle, then there is no feasible solution for the system.

Problems Ex Ex Ex Ex Ex Ex Ex Ex