CSE 780 Algorithms Advanced Algorithms Shortest path Shortest path tree Relaxation Bellman-Ford Alg.

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
November 14, Algorithms and Data Structures Lecture XIII Simonas Šaltenis 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.
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 22.
Shortest Paths Algorithm Design and Analysis Week 7 Bibliography: [CLRS] – chap 24 [CLRS] – chap 25.
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,
Introduction to Algorithms 6.046J/18.401J/SMA5503
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
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.
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
CSE 780 Algorithms Advanced Algorithms Graph Alg. DFS Topological sort.
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.
CSE 780 Algorithms Advanced Algorithms Graph Algorithms Representations BFS.
1 Advanced Algorithms All-pairs SPs DP algorithm Floyd-Warshall alg.
CSE 780 Algorithms Advanced Algorithms SSSP Dijkstra’s algorithm SSSP in DAGs.
Analysis of Algorithms CS 477/677 Shortest Paths Instructor: George Bebis Chapter 24.
1 Graph Algorithms Single source shortest paths problem Dana Shapira.
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. Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the.
Shortest Paths Introduction to Algorithms Shortest Paths CSE 680 Prof. Roger Crawfis.
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.
COSC 3101NJ. Elder Assignment 2 Remarking Assignment 2 Marks y = 0.995x R 2 = Old Mark New Mark.
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.
CS223 Advanced Data Structures and Algorithms 1 The Bellman-Ford Shortest Path Algorithm Neil Tang 03/11/2010.
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.
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.
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.
Shortest Paths CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Lecture 13 Algorithm Analysis
1 Weighted Graphs. 2 Outline (single-source) shortest path –Dijkstra (Section 4.4) –Bellman-Ford (Section 4.6) (all-pairs) shortest path –Floyd-Warshall.
Greedy Algorithms Z. GuoUNC Chapel Hill CLRS CH. 16, 23, & 24.
Introduction to Algorithms All-Pairs Shortest Paths My T. UF.
CSE Graph Search Algorithms. CSE Graph a c b Node ~ city or computer Edge ~ road or data cable Undirected or Directed A surprisingly large.
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.
Minimum Spanning Trees
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Basic Graph Algorithms
Algorithms and Data Structures Lecture XIII
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Lecture 13 Algorithm Analysis
Shortest Path Problems
Advanced Algorithms Analysis and Design
CS 3013: DS & Algorithms Shortest Paths.
Presentation transcript:

CSE 780 Algorithms Advanced Algorithms Shortest path Shortest path tree Relaxation Bellman-Ford Alg.

CSE 780 Algorithms Shortest Path Directed graph G = (V, E) with weight function w : E --> R Shortest path weight:

CSE 780 Algorithms Various Problems Single-source shortest-paths problem Given source node s to all nodes from V Single-destination shortest-paths problem From all nodes in V to a destination u Single-pair shortest-path problem Shortest path between u and v All-pairs shortest-paths problem Shortest paths between all pairs of nodes

CSE 780 Algorithms Negative-weight Edges Some edges may have negative weights If there is a negative cycle reachable from s: Shortest path is no longer well-defined Example Otherwise, it is fine

CSE 780 Algorithms Cycles Shortest path cannot have cycles inside Negative cycles : already eliminated Positive cycles: can be removed 0-weight cycles: can be removed So each shortest path does not have cycles

CSE 780 Algorithms Optimal Substructure Property Given a shortest path, any subpath is also a shortest path between corresponding nodes Proof by contradiction

CSE 780 Algorithms Shortest-paths Tree For every node v  V, π[v] is the predecessor of v in shortest path from source s to v Nil if does not exist All our algorithm will output a shortest-path tree Root is source s Edges are (π[v], v) The shortest path between s and v is the unique tree path from root s to v.

CSE 780 Algorithms Example

CSE 780 Algorithms Goal: Input: directed weighted graph G = (V, E), source node s  V Output: For every vertex v  V, d[v] =  (s, v) π[v] Shortest-paths tree induced by π[v]

CSE 780 Algorithms Intuition Compared to Breadth-first search Main difference?

CSE 780 Algorithms Basic Operation: Relaxation Maintain shortest-path estimate d[v] for each node d[v]: initialize  Algorithms will repeatedly apply Relax. Differ in the order of Relax operation Intuition: Do we have a shorter path if use edge (u,v) ?

CSE 780 Algorithms Shortest-paths Properties Triangle inequality For (u, v)  E,  (s, v) ≤  (s, u) + w(u, v) Equality holds when u is predecessor of v. Upper-bound property If start with d[v] =  and apply Relax operations Always have d[v] ≥  (s, v) Once d[v] =  (s, v), never changes

CSE 780 Algorithms Properties cont. Convergence property Suppose s  u -> v is the shortest path from s to v Currently d[u] =  (s, u) Relax (u,v) will set d[v] =  (s, v) Proof: follow from Relaxation definition Path-relaxation property Given a shortest path Apply Relax in order Then, afterwards, Proof: Follow from above property

CSE 780 Algorithms Bellman-Ford Algorithm Allow negative weights Follow the frame work that first, initialize: Then apply a set of Relax compute d[v] and π[v] Return False if there exists negative cycles

CSE 780 Algorithms Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

CSE 780 Algorithms Pseudo-code Time complexity: O(VE)

CSE 780 Algorithms Example

CSE 780 Algorithms Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

CSE 780 Algorithms Correctness Why d[v] =  (s, v) for every node v ? Proof: Use path-relaxation property Return True (or False) iff there is (or is no) negative cycles ? If there is no negative cycle: obvious use triangle inequality If there is negative cycle: Proof by contradiction