Dijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance. Decision Sequence.

Similar documents
Dijkstra s Single Source Algorithm. All-Pairs Shortest Paths. Dynamic Programming Solution. Performance

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

The Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique

Greedy Technique - Definition

CS1100 Introduction to Programming

Programming in Fortran 90 : 2017/2018

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms

Dynamic Programming. Example - multi-stage graph. sink. source. Data Structures &Algorithms II

All-Pairs Shortest Paths. Approximate All-Pairs shortest paths Approximate distance oracles Spanners and Emulators. Uri Zwick Tel Aviv University

Conditional Speculative Decimal Addition*

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

O n processors in CRCW PRAM

Harmonic Coordinates for Character Articulation PIXAR

Problem Set 3 Solutions

EECS 730 Introduction to Bioinformatics Sequence Alignment. Luke Huan Electrical Engineering and Computer Science

Problem Definitions and Evaluation Criteria for Computational Expensive Optimization

LECTURE : MANIFOLD LEARNING

U.C. Berkeley CS294: Beyond Worst-Case Analysis Handout 5 Luca Trevisan September 7, 2017

Gaussian elimination. System of Linear Equations. Gaussian elimination. System of Linear Equations

Outline. Discriminative classifiers for image recognition. Where in the World? A nearest neighbor recognition example 4/14/2011. CS 376 Lecture 22 1

Terminal Window. 11. Section 7 Exercises Program Memory Exercise 7-1 Swap Values in an Array Working memory Global Memory. 2 nd call 3 rd call

Computer Animation and Visualisation. Lecture 4. Rigging / Skinning

Support Vector Machines

Analysis of Continuous Beams in General

Loop Transformations, Dependences, and Parallelization

Outline. Self-Organizing Maps (SOM) US Hebbian Learning, Cntd. The learning rule is Hebbian like:

SIGGRAPH Interactive Image Cutout. Interactive Graph Cut. Interactive Graph Cut. Interactive Graph Cut. Hard Constraints. Lazy Snapping.

Sorting Review. Sorting. Comparison Sorting. CSE 680 Prof. Roger Crawfis. Assumptions

Radial Basis Functions

Sorting. Sorted Original. index. index

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

An efficient iterative source routing algorithm

Module Management Tool in Software Development Organizations

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Faster Shortest Paths in Dense Distance Graphs, with Applications

1 Introducton Gven a graph G = (V; E), a non-negatve cost on each edge n E, and a set of vertces Z V, the mnmum Stener problem s to nd a mnmum cost su

Multiple optimum values

Hierarchical clustering for gene expression data analysis

LECTURE NOTES Duality Theory, Sensitivity Analysis, and Parametric Programming

CS221: Algorithms and Data Structures. Priority Queues and Heaps. Alan J. Hu (Borrowing slides from Steve Wolfman)

Capacitated Domination and Covering: A Parameterized Perspective

Polyhedral Compilation Foundations

Private Information Retrieval (PIR)

Motivation. EE 457 Unit 4. Throughput vs. Latency. Performance Depends on View Point?! Computer System Performance. An individual user wants to:

Reading. 14. Subdivision curves. Recommended:

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example

Programming Assignment Six. Semester Calendar. 1D Excel Worksheet Arrays. Review VBA Arrays from Excel. Programming Assignment Six May 2, 2017

CS240: Programming in C. Lecture 12: Polymorphic Sorting

Fast exponentiation via prime finite field isomorphism


The Codesign Challenge

Load Balancing for Hex-Cell Interconnection Network

SENSITIVITY ANALYSIS IN LINEAR PROGRAMMING USING A CALCULATOR

An exhaustive error-bounding algorithm for hierarchical radiosity

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE

Kinematics of pantograph masts

On Some Entertaining Applications of the Concept of Set in Computer Science Course

Midterms Save the Dates!

Active Contours/Snakes

Lecture 5: Multilayer Perceptrons

Mathematics 256 a course in differential equations for engineering students

LU Decomposition Method Jamie Trahan, Autar Kaw, Kevin Martin University of South Florida United States of America

Today s Outline. Sorting: The Big Picture. Why Sort? Selection Sort: Idea. Insertion Sort: Idea. Sorting Chapter 7 in Weiss.

A mathematical programming approach to the analysis, design and scheduling of offshore oilfields

Fitting: Deformable contours April 26 th, 2018

Interactive Rendering of Translucent Objects

5 The Primal-Dual Method

Face Detection with Deep Learning

Optimization Methods: Integer Programming Integer Linear Programming 1. Module 7 Lecture Notes 1. Integer Linear Programming

Harvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)

Subspace clustering. Clustering. Fundamental to all clustering techniques is the choice of distance measure between data points;

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

A Variable Elimination Approach for Optimal Scheduling with Linear Preferences

FAST AND DETERMINISTIC COMPUTATION OF FIXATION PROBABILITY IN EVOLUTIONARY GRAPHS

Open Access A New Algorithm for the Shortest Path of Touring Disjoint Convex Polygons

Very simple computational domains can be discretized using boundary-fitted structured meshes (also called grids)

Covering Pairs in Directed Acyclic Graphs

An efficient method to build panoramic image mosaics

Parallel Solutions of Indexed Recurrence Equations

11. APPROXIMATION ALGORITHMS

Outline. Midterm Review. Declaring Variables. Main Variable Data Types. Symbolic Constants. Arithmetic Operators. Midterm Review March 24, 2014

Sorting and Algorithm Analysis

CSE 326: Data Structures Quicksort Comparison Sorting Bound

Real-Time Systems. Real-Time Systems. Verification by testing. Verification by testing

An Entropy-Based Approach to Integrated Information Needs Assessment

CSE 326: Data Structures Quicksort Comparison Sorting Bound

IMRT workflow. Optimization and Inverse planning. Intensity distribution IMRT IMRT. Dose optimization for IMRT. Bram van Asselen

An Efficient Algorithm for Minimum Vertex Cover Problem

Solving two-person zero-sum game by Matlab

A Binarization Algorithm specialized on Document Images and Photos

Searching & Sorting. Definitions of Search and Sort. Linear Search in C++ Linear Search. Week 11. index to the item, or -1 if not found.

Identifying Top-k Most Influential Nodes by using the Topological Diffusion Models in the Complex Networks

GSLM Operations Research II Fall 13/14

Cooperative UAV Trajectory Planning with Multiple Dynamic Targets

Introduction to Geometrical Optics - a 2D ray tracing Excel model for spherical mirrors - Part 2

Needed Information to do Allocation

Three supervised learning methods on pen digits character recognition dataset

How Accurately Can We Model Timing In A Placement Engine?

Announcements. Supervised Learning

Transcription:

All-Pars Shortest Paths Gven an n-vertex drected weghted graph, fnd a shortest path from vertex to vertex for each of the n vertex pars (,). Dstra s Sngle Source Algorthm Use Dstra s algorthm n tmes, once wth each of the n vertces as the source vertex. Performance Tme complexty s O(n ) tme. Wors only when no edge has a cost < 0. Dynamc Programmng Soluton Tme complexty s Theta(n ) tme. Wors so long as there s no cycle whose length s < 0. When there s a cycle whose length s < 0, some shortest paths aren t fnte. ƒ If vertex s on a cycle whose length s -, each tme you go around ths cycle once you get a to path that s unts shorter than the prevous one. Smpler to code, smaller overheads. Known as Floyd s shortest paths algorthm. Decson Sequence Frst decde the hghest ntermedate vertex (.e., largest vertex number) on the shortest path from to. If the shortest path s,,,,,,, the frst decson s that vertex s an ntermedate vertex on the shortest path and no ntermedate vertex s larger than. Then decde the hghest ntermedate vertex on the path from to, and so on. Problem State (,,) denotes the problem of fndng the shortest path from vertex to vertex that has no ntermedate vertex larger than. (,,n) denotes the problem of fndng the shortest path from vertex to vertex (wth no restrctons on ntermedate vertces).

Cost Functon Let c(,,) be the length of a shortest path from vertex to vertex that has no ntermedate vertex larger than. c(,,n) c(,,n) s the length of a shortest path from vertex to vertex that has no ntermedate vertex larger than n. No vertex s larger than n. Therefore, c(,,n) s the length of a shortest path from vertex to vertex. c(,,0) c(,,0) s the length of a shortest path from vertex to vertex that has no ntermedate vertex larger than 0. ƒ Every vertex s larger than 0. ƒ Therefore, c(,,0) s the length of a sngle-edge path from vertex to vertex. Recurrence For c(,,), > 0 The shortest path from vertex to vertex that has no ntermedate vertex larger than may or may not go through vertex. If ths shortest path does not go through vertex, the largest permssble ntermedate vertex s -. So the path length s c(,,-). < Recurrence For c(,,) ), > 0 Shortest path goes through vertex. We may assume that vertex s not repeated because no cycle has negatve length. Largest permssble ntermedate vertex on to and to paths s -. Recurrence For c(,,) ), > 0 to path must be a shortest to path that goes through no vertex larger than -. If not, replace current to path wth a shorter to path to get an even shorter to path.

Recurrence For c(,,) ), > 0 Recurrence For c(,,) ), > 0 Smlarly, to path must be a shortest to path that goes through no vertex larger than -. Therefore, length of to path s c(,,-), and length of to path s c(,,-). So, c(,,) = c(,,-) + c(,,-). Combnng the two equatons for c(,,), we get c(,,) = mn{c(,,-), c(,,-) + c(,,-)}. We may compute the c(,,)s n the order =,,,, n. Floyd s Shortest Paths Algorthm for (nt = ; <= n; ++) for (nt = ; <= n; ++) for (nt = ; <= n; ++) c(,,) = mn{c(,,-), c(,,-) + c(,,-)}; Tme complexty s O(n ). More precsely Theta(n ). Theta(n ) space s needed for c(*,*,*). Space Reducton c(,,) = mn{c(,,-), c(,,-) + c(,,-)} When nether nor equals, c(,,-) s used only n the computaton of c(,,). column (,) So c(,,) can overwrte c(,,-). row Space Reducton c(,,) = mn{c(,,-), c(,,-) + c(,,-)} When equals, c(,,-) equals c(,,). ƒ c(,,) = mn{c(,,-), c(,,-) + c(,,-)} = mn{c(,,-), 0 + c(,,-)} = c(,,-) So, when equals, c(,,) can overwrte c(,,-). Smlarly when equals, c(,,) can overwrte c(,,-). So, n all cases c(,,) can overwrte c(,,-). Floyd s Shortest Paths Algorthm for (nt = ; <= n; ++) for (nt = ; <= n; ++) for (nt = ; <= n; ++) c(,) = mn{c(,), c(,) + c(,)}; Intally, c(,) = c(,,0). Upon termnaton, c(,) = c(,,n). Tme complexty s Theta(n ). Theta(n ) space s needed for c(*,*).

Buldng The Shortest Paths Let ay(,) be the largest vertex on the shortest path from to. Intally, ay(,) = 0 (shortest path has no ntermedate vertex). for (nt = ; <= n; ++) for (nt = ; <= n; ++) for (nt = ; <= n; ++) f (c(,) > c(,) + c(,)) {ay(,) = ; c(,) = c(,) + c(,);} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example Intal Cost Matrx c(*,*) = c(*,*,0) Fnal Cost Matrx c(*,*) = c(*,*,n) ay Matrx 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Shortest Path Buld A Shortest Path Shortest path from to. Path length s. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The path s. ay(,) = ay(,) = ay(,) =

Buld A Shortest Path Buld A Shortest Path 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The path s. ay(,) = 0 ay(,) = ay(,) = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The path s. ay(,) = 0 ay(,) = 0 ay(,) = Buld A Shortest Path Output A Shortest Path 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The path s. ay(,) = 0 ay(,) = 0 publc statc vod outputpath(nt, nt ) {// does not output frst vertex () on path f ( == ) return; f (ay[][] == 0) // no ntermedate vertces on path System.out.prnt( + " "); else {// ay[][] s an ntermedate vertex on the path outputpath(, ay[][]); outputpath(ay[][], ); } } Tme Complexty Of outputpath O(number of vertces on shortest path)