All-Pairs Shortest Paths & Essential Subgraph 01/25/2005 Jinil Han.

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
November 14, Algorithms and Data Structures Lecture XIII Simonas Šaltenis Aalborg University
Advanced Algorithm Design and Analysis (Lecture 7) SW5 fall 2004 Simonas Šaltenis E1-215b
1 Theory I Algorithm Design and Analysis (10 - Shortest paths in graphs) T. Lauer.
Design and Analysis of Algorithms Single-source shortest paths, all-pairs shortest paths Haidong Xue Summer 2012, at GSU.
CSE 101- Winter ‘15 Discussion Section January 26th 2015.
By Amber McKenzie and Laura Boccanfuso. Dijkstra’s Algorithm Question: How do you know that Dijkstra’s algorithm finds the shortest path and is optimal.
The Shortest Path Problem. Shortest-Path Algorithms Find the “shortest” path from point A to point B “Shortest” in time, distance, cost, … Numerous.
CSCI 3160 Design and Analysis of Algorithms Tutorial 2 Chengyu Lin.
1 Greedy 2 Jose Rolim University of Geneva. Algorithmique Greedy 2Jose Rolim2 Examples Greedy  Minimum Spanning Trees  Shortest Paths Dijkstra.
CPSC 411, Fall 2008: Set 9 1 CPSC 411 Design and Analysis of Algorithms Set 9: More Graph Algorithms Prof. Jennifer Welch Fall 2008.
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 421 Algorithms Richard Anderson Dijkstra’s algorithm.
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.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Shortest Paths Definitions Single Source Algorithms
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.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
Dijkstra’s Algorithm Slide Courtesy: Uwash, UT 1.
CS 253: Algorithms Chapter 24 Shortest Paths Credit: Dr. George Bebis.
Shortest Paths1 C B A E D F
The Shortest Path Problem
CS 473 All Pairs Shortest Paths1 CS473 – Algorithms I All Pairs Shortest Paths.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Dijkstra's algorithm.
Graphs – Shortest Path (Weighted Graph) ORD DFW SFO LAX
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Shortest Path Algorithms. Kruskal’s Algorithm We construct a set of edges A satisfying the following invariant:  A is a subset of some MST We start with.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Graph Algorithms Shortest-Path.
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.
5/27/03CSE Shortest Paths CSE Algorithms Shortest Paths Problems.
1 WEEK 9-10 Graphs II Unweighted Shortest Paths Dijkstra’s Algorithm Graphs with negative costs Acyclic Graphs Izmir University of Economics.
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.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
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.
Dijkstra’s Algorithm Supervisor: Dr.Franek Ritu Kamboj
Spanning Trees CSIT 402 Data Structures II 1. 2 Two Algorithms Prim: (build tree incrementally) – Pick lower cost edge connected to known (incomplete)
1 The Floyd-Warshall Algorithm Andreas Klappenecker.
All-pairs Shortest Paths. p2. The structure of a shortest path: All subpaths of a shortest path are shortest paths. p : a shortest path from vertex i.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
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)
Shortest Path Graph Theory Basics Anil Kishore.
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.
Weighted Graphs Computing 2 COMP s1 Sedgewick Part 5: Chapter
1 Prim’s algorithm. 2 Minimum Spanning Tree Given a weighted undirected graph G, find a tree T that spans all the vertices of G and minimizes the sum.
Lecture 13 Algorithm Analysis
Minimum Spanning Trees CSE 373 Data Structures Lecture 21.
All-Pairs Shortest Paths
Introduction to Algorithms All-Pairs Shortest Paths My T. UF.
CSCE 411 Design and Analysis of Algorithms Set 9: More Graph Algorithms Prof. Jennifer Welch Spring 2012 CSCE 411, Spring 2012: Set 9 1.
Single Source Shortest Paths Chapter 24 CSc 4520/6520 Fall 2013 Slides adapted from George Bebis, University of Reno, Nevada.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
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])
CSE 373: Data Structures and Algorithms Lecture 21: Graphs V 1.
Short paths and spanning trees
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
CS 583 Analysis of Algorithms
Autumn 2015 Lecture 10 Minimum Spanning Trees
Minimum Spanning Tree Algorithms
All pairs shortest path problem
Minimum Spanning Trees
Graph Algorithms: Shortest Path
Presentation transcript:

All-Pairs Shortest Paths & Essential Subgraph 01/25/2005 Jinil Han

Problem Description  Finding shortest paths between all pairs of vertices in a directed graph G=(V,E) with nonnegative edge weights n=|V|, m=|E|

Well-known Algorithms  Dijkstra’s algorithm running a single-source shortest paths algorithm |V| times O(n 2 lgn + nm), when implementing priority queue with a Fibonacci heap when all edge weights are nonnegative ** Fibonacci heap delete-min : O(lgn) priority change : O(1)

Well-known Algorithms  Bellman-Ford algorithm d j (m+1) = min {d j (m), min {d k (m), +a kj }} O(n 2 m), O(n 4 ) if graph is dense negative edges are allowed  Floyd-Warshall algorithm d ij (k) = min {d ij (k-1), d ik (k-1) + d kj (k-1) } O(n 3 ) negative edges are allowed Now, introduce two algorithms with running time of O(n 2 lgn+ns)

 Run Dijkstra’s single source algorithm in parallel for all points in the graph  Discover the hidden “shortest path structure” (essential subgraph H)  Running time is equivalent to solving n single-source shortest path problems using only the edges in H O(n 2 lgn + ns), s = the number of edges in H  s is likely to be small in practice, for general random graph, s = O(nlgn) almost surely  expected running time is O(n 2 lgn) Algorithm Outline

Hidden Paths Algorithm  Maintains a heap containing for each ordered pair of vertices u, v the best path from u to v found so far  At each iteration, removes a path (u~v), from top of the heap (this is the optimal path from u to v)  This path is now used to construct a set of new candidate paths  If a new candidate path (w~t) is shorter, it replaces the current best path from w to t in the heap  This maintains the optimality of the path at the top of the heap

Hidden Paths Algorithm

 Example

Hidden Paths Algorithm  Running time analysis 1. the initialization step : a heap of size O(n 2 ) 2. Step 1 & Step 2 : at most n(n-1) times  at most n(n-1) delete-min operations 3. the only candidate paths created are those of the form (u,v~w) where both (u,v) and (v~w) are optimal  The total number of candidate paths created is O(sn)  At most one priority change operation associated with each candidate path

Hidden Path Algorithm  Running time analysis

SHORT Algorithm  Rather than iterating over nodes to solve n SSP problems, the algorithm iterates over edges and solves the SSP problem incrementally ( same as hidden Path algorithm)  It is efficient because each distance need only be computed once  The two algorithms would discover and report distances in different order  The n shortest-path trees are constructed as a by-product of SHORT but not of Hidden Path algorithm

SHORT Algorithm  Essential subgraph contain an edge (x,y) in E whenever d(x,y) =c(x,y) and there is no alternate path of equivalent cost, that is, edge (x,y) is in H when it is uniquely the shortest path in G between x and y G H

SHORT Algorithm  Think of SHORT as an algorithm for constructing H  SHORT builds H correctly (refer to a paper for proof)

SHORT Algorithm  The Search Procedure returns a decision accept or reject depending on whether an alternate path exists in the partially built subgraph H i construct n single-source trees incrementally ** review of Dijkstra’s algorithm A shortest path tree T(v) rooted at v is built maintain a heap of fringe vertices which are not in T(v) but are adjacent to vertices in T(v) vertices are extracted from the fringe heap and added to T(v) Dijkstra-Process(v,x,y) operates on edge (x,y) when vertex x is added to T(v)

SHORT Algorithm  The Search Procedure

SHORT Algorithm  Example

SHORT Algorithm  Running time analysis for each vertex, Dijkstra-Process processes each edge of H exactly once at most n inserts, deletes, and s decrease-key operations on the fringe heap  O(s + nlgn) using Fibonacci heaps  The total cost is therefore O(n 2 lgn + ns)

s in a Random graph  To predict behavior of algorithms in practice for a large class of probability distributions on random graph, s= O(nlgn) consider dist. F on nonnegative edge weights, which doesn’t depend on n, such that F’(0) > 0 (Ex. Uniform and exponential) Th. Let G be complete directed graph, whose edge weights are chosen independently according to F. Then with probability 1-O(n -1 ), the diameter of G is O(lgn/n), and hence s = O(nlgn)  with high probability the running time of the algorithms are O(n 2 lgn)

Essential Subgraph  The essential subgraph is unique and that for every pair of vertices there is a shortest path between them comprising only edges in H  H is the optimal subgraph for distance computations on G  H is exactly the union of n SSP trees and H must contain a minimum spanning tree of G