Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt

Slides:



Advertisements
Similar presentations
Single Source Shortest Paths
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=
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro.
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.
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.
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.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 15 Shortest paths algorithms Properties of shortest paths Bellman-Ford algorithm.
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.
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.
CSE 2331 / 5331 Topic 12: Shortest Path Basics Dijkstra Algorithm Relaxation Bellman-Ford Alg.
Lecture 13 Algorithm Analysis
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])
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
Single-Source Shortest Path
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Algorithms and Data Structures Lecture XIII
Minimum Spanning Tree Shortest Paths
Shortest Path Problems
Minimum Spanning Trees
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
SINGLE-SOURCE SHORTEST PATHS
Elementary graph algorithms Chapter 22
Lecture 7 Shortest Path Shortest-path problems
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CSCE 411 Design and Analysis of Algorithms
Algorithms (2IL15) – Lecture 5 SINGLE-SOURCE SHORTEST PATHS
Advanced Algorithms Analysis and Design
Algorithms and Data Structures Lecture XIII
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CSC 413/513: Intro to Algorithms
Lecture 13 Algorithm Analysis
CSCE 411 Design and Analysis of Algorithms
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Lecture 13 Algorithm Analysis
Shortest Path Problems
Chapter 24: Single-Source Shortest Paths
Advanced Algorithms Analysis and Design
Shortest Path Problems
Chapter 24: Single-Source Shortest Paths
Elementary graph algorithms Chapter 22
CS 3013: DS & Algorithms Shortest Paths.
Chapter 24: Single-Source Shortest-Path
Single-Source Shortest Path & Minimum Spanning Trees
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Advanced Algorithms Analysis and Design
Presentation transcript:

Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Prof. 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 = parent in the shortest-paths tree

d [v] is the shortest path estimate to v. In fact, d [v] will always be at least as long as the actual shortest path.

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 = (v0, v1, …, vk) is a shortest path from s = v0 to vk, and the edges of p are relaxed in the order (v0,v1), (v1,v2), …, (vk-1,vk), then d[vk] = δ(s,vk). 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 then Bellman-Ford returns FALSE. Running time: (|V||E|)

Topologically Sorting a DAG (Directed Acyclic Graph) A topological sort of the nodes of a DAG G is a linear ordering such that there is no edge of G going from a node to a predecessor in the ordering.

// all edge weights are assumed non-negative S = {v : d [v] = δ(s,v)}, i.e., vertices for which the shortest path from s has been determined. Q is a min heap of vertices of G keyed by their d (i.e., estimate) values.

Proof that Dijkstra is correct

x1 – x2 ≤ 0, x1 – x5 ≤ -1, x2 – x5 ≤ 1, x3 – x1 ≤ 5, x4 – x1 ≤ 4, x4 – x3 ≤ -1, x5 – x3 ≤ -3, x5 – x4 ≤ -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 = ( δ(v0, v1), δ(v0, v2), …, δ(v0, vk) ) 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. 24.1-1 Ex. 24.2-1 Ex. 24.3-1 Ex. 24.3-2 Ex. 24.3-4