Shortest Path Algorithms. Lecture I: Shortest Path Algorithms. Example. Graphs and Matrices. Setting: Dr Kieran T. Herley.

Similar documents
Lecture I: Shortest Path Algorithms

CENG 477 Introduction to Computer Graphics. Modeling Transformations

4. Minimax and planning problems

COMP26120: Algorithms and Imperative Programming

Gauss-Jordan Algorithm

4.1 3D GEOMETRIC TRANSFORMATIONS

Sam knows that his MP3 player has 40% of its battery life left and that the battery charges by an additional 12 percentage points every 15 minutes.

Data Structures and Algorithms. The material for this lecture is drawn, in part, from The Practice of Programming (Kernighan & Pike) Chapter 2

A Matching Algorithm for Content-Based Image Retrieval

6.8 Shortest Paths. Chapter 6. Dynamic Programming. Shortest Paths: Failed Attempts. Shortest Paths

Net Ne w t ork y La e y r Net Ne w t ork y La e y r Initial motivation: Net Ne w t ork y La e y r Net Ne w t ork y La e y r Net Ne w t ork

MARSS Reference Sheet

Lecture 18: Mix net Voting Systems

Outline. CS38 Introduction to Algorithms 5/8/2014. Network flow. Lecture 12 May 8, 2014

Data Structures and Algorithms

EECS 487: Interactive Computer Graphics

Coded Caching with Multiple File Requests

Implementing Ray Casting in Tetrahedral Meshes with Programmable Graphics Hardware (Technical Report)

REDUCTIONS BBM ALGORITHMS DEPT. OF COMPUTER ENGINEERING ERKUT ERDEM. Bird s-eye view. May. 12, Reduction.

COSC 3213: Computer Networks I Chapter 6 Handout # 7

Maximum Flows: Polynomial Algorithms

Constant-Work-Space Algorithms for Shortest Paths in Trees and Simple Polygons

Learning in Games via Opponent Strategy Estimation and Policy Search

Chapter 8 LOCATION SERVICES

MATH Differential Equations September 15, 2008 Project 1, Fall 2008 Due: September 24, 2008

Mobile Robots Mapping

Restorable Dynamic Quality of Service Routing

NEWTON S SECOND LAW OF MOTION

Less Pessimistic Worst-Case Delay Analysis for Packet-Switched Networks

Chapter Six Chapter Six

Systems & Biomedical Engineering Department. Transformation

the marginal product. Using the rule for differentiating a power function,

PART 1 REFERENCE INFORMATION CONTROL DATA 6400 SYSTEMS CENTRAL PROCESSOR MONITOR

Network management and QoS provisioning - QoS in Frame Relay. . packet switching with virtual circuit service (virtual circuits are bidirectional);

Flow graph/networks MAX FLOW APPLICATIONS. Flow constraints. Max flow problem 4/26/12

Point Cloud Representation of 3D Shape for Laser- Plasma Scanning 3D Display

Scattering at an Interface: Normal Incidence

Image segmentation. Motivation. Objective. Definitions. A classification of segmentation techniques. Assumptions for thresholding

Section 2. Mirrors and Prism Systems

Assignment 2. Due Monday Feb. 12, 10:00pm.

Computational Geometry in Wireless Networks - Routing. Presented by Heather M. Michaud

SREM: A Novel Multicast Routing Algorithm - Comprehensive Cost Analysis

STEREO PLANE MATCHING TECHNIQUE

MOTION DETECTORS GRAPH MATCHING LAB PRE-LAB QUESTIONS

It is easier to visualize plotting the curves of cos x and e x separately: > plot({cos(x),exp(x)},x = -5*Pi..Pi,y = );

Optimal Crane Scheduling

A Routing Algorithm for Flip-Chip Design

Distributed Task Negotiation in Modular Robots

Midterm Exam Announcements

Piecewise Linear Models

Traditional Rendering (Ray Tracing and Radiosity)

M y. Image Warping. Targil 7 : Image Warping. Image Warping. 2D Geometric Transformations. image filtering: change range of image g(x) = T(f(x))

Computer representations of piecewise

Packet Scheduling in a Low-Latency Optical Interconnect with Electronic Buffers

4 Error Control. 4.1 Issues with Reliable Protocols

Numerical Solution of ODE

CS 152 Computer Architecture and Engineering. Lecture 7 - Memory Hierarchy-II

In fmri a Dual Echo Time EPI Pulse Sequence Can Induce Sources of Error in Dynamic Magnetic Field Maps

1 œ DRUM SET KEY. 8 Odd Meter Clave Conor Guilfoyle. Cowbell (neck) Cymbal. Hi-hat. Floor tom (shell) Clave block. Cowbell (mouth) Hi tom.

Announcements For The Logic of Boolean Connectives Truth Tables, Tautologies & Logical Truths. Outline. Introduction Truth Functions

Applications of N-Structures to Ideal Theory of LA-Semigroup

AML710 CAD LECTURE 11 SPACE CURVES. Space Curves Intrinsic properties Synthetic curves

Ray Tracing II. Improving Raytracing Speed. Improving Computational Complexity. Raytracing Computational Complexity

Using CANopen Slave Driver

CS422 Computer Networks

LAMP: 3D Layered, Adaptive-resolution and Multiperspective Panorama - a New Scene Representation

A Principled Approach to. MILP Modeling. Columbia University, August Carnegie Mellon University. Workshop on MIP. John Hooker.

Evaluation and Improvement of Region-based Motion Segmentation

UX260 QUICK START GUIDE

Improving Ranking of Search Engines Results Based on Power Links

Image Content Representation

Scalable Big Graph Processing in MapReduce

Quantitative macro models feature an infinite number of periods A more realistic (?) view of time

Simple Network Management Based on PHP and SNMP

Rou$ng. Rou$ng: Mapping Link to Path. Data and Control Planes. Rou$ng vs. Forwarding. Rou$ng Protocols. What Does the Protocol Compute?

shared via CourseHero.com This study resource was Exam #1 for Computer Networks (CIS 6930) Fall 2003 >>> SOLUTIONS <<<

MIC2569. Features. General Description. Applications. Typical Application. CableCARD Power Switch

ECO-friendly Distributed Routing Protocol for Reducing Network Energy Consumption

SOT: Compact Representation for Triangle and Tetrahedral Meshes

Dynamic Route Planning and Obstacle Avoidance Model for Unmanned Aerial Vehicles

Handling uncertainty in semantic information retrieval process

Spline Curves. Color Interpolation. Normal Interpolation. Last Time? Today. glshademodel (GL_SMOOTH); Adjacency Data Structures. Mesh Simplification

Exercise 3: Bluetooth BR/EDR

Today. Curves & Surfaces. Can We Disguise the Facets? Limitations of Polygonal Meshes. Better, but not always good enough

A Tool for Multi-Hour ATM Network Design considering Mixed Peer-to-Peer and Client-Server based Services

Difficulty-aware Hybrid Search in Peer-to-Peer Networks

Chapter 4 Sequential Instructions

Motor Control. 5. Control. Motor Control. Motor Control

Lecture 4. Programming with Message Passing: Applications and Performance

Robust Multi-view Face Detection Using Error Correcting Output Codes

/85/ $ IEEE

Hyelim Oh. School of Computing, National University of Singapore, 13 Computing Drive, Singapore SINGAPORE

Parallel and Distributed Systems for Constructive Neural Network Learning*

An Efficient Delivery Scheme for Coded Caching

Last Time: Curves & Surfaces. Today. Questions? Limitations of Polygonal Meshes. Can We Disguise the Facets?

CAMERA CALIBRATION BY REGISTRATION STEREO RECONSTRUCTION TO 3D MODEL

Fast Restoration Signaling in Optical Networks

Automatic Calculation of Coverage Profiles for Coverage-based Testing

A Progressive-ILP Based Routing Algorithm for Cross-Referencing Biochips

Y. Tsiatouhas. VLSI Systems and Computer Architecture Lab

Transcription:

Shores Pah Algorihms Background Seing: Lecure I: Shores Pah Algorihms Dr Kieran T. Herle Deparmen of Compuer Science Universi College Cork Ocober 201 direced graph, real edge weighs Le he lengh of a pah be he sum of is edge weighs and le δ(s, u) = lengh of shores pah from s o u Reduces o edge disance if all weighs are 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 2 / 1 Eample Background Graphs and Marices Single source shores pah problem Given a weighed graph G and a designaed node s G, deermine δ(s, u) for each u G. u δ(s, u) s 0 a 8 b c d 5 All pairs shores pah problem Given a weighed graph G, deermine δ(, ) for each, G. A Graph and is mari represenaion (nodes lised alpaheicall a = 1 ec.) 0 8 0 1 0 2 5 0 0 0 if i = j w = weigh(i, j) if i j and (i, j) E if i j and (i, j) E No negaive ccles allowed oherwise shores pah noion no well defined KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 / 1

Some Terminolog k-pah pah all of whose inermediae nodes are numbered less han or equal o k; (he sar/end nodes ma have numbers greaer han k). Consider shores k-pah from i o j : Bes pah is π is beer of α or β k γ eiher i passes hrough node k (once): 2- i.e. consiss of β = shores (k 1)-pah from i o k node k γ = shores (k 1)-pah from k o j or i does no pass hrough node k: α = shores (k 1)-pah from i o j KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 5 / 1 A useful ideni Definiion l (k) = lengh of shores k-pah joining i o j. l (k) = { w if k = 0 min{l (k 1), l (k 1) i,k + l (k 1) k,j } if k > 0 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 / 1 Observaion Visualie he se of l (k) quaniies as hree-dimensional grid wih poin l (k) having co-ordinaes (i, j, k). l (k) = { w if k = 0 min{l (k 1), l (k 1) i,k + l (k 1) k,j } if k > 0 Noice: each horional slice represens values l (k) for some fied k he quaniies in he boom slice (k = 0) depend onl on edge weighs each quani l (k) on slice k depends onl on quaniies on he slice below KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 / 1 Algorihm FLOYD WARSHALL(G): W = mari of edge weighs for i 1 o n do for j 1 o n do L[ i, j, 0] W[i, j ] for k 1 o n do for i 1 o n do for j 1 o n do if L[ i, j, k 1] < L[i, k, k 1] + L[k, j, k 1] L[ i, j, k] L[i, j, k 1] else L[ i, j, k] L[i, k, k 1] + L[k, j, k 1] KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 8 / 1

Noes Transiive Closure Lengh of shores i-o-j pah in L[i, j, n]. Negaive weigh OK, bu no negaive ccles. Running ime: O(n ) Can ge b wih 2D arras (wo for alernae slices) Can be modified o produce pahs (no jus lenghs) The ransiive closure of G = (V, E) he he graph G = (v, E ) such ha here is an edge in G from u i v if and onl if here is a pah in G from u o v. Algorihm: Give weigh 1 o each edge in G; Run Flod-Warshall algorihm; Each L[i, j, n] denoes pah in G, so add corresponding edge (i, j) o E. KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 10 / 1 Single-Source Shores Pah Problem Single-source shores pah problem (SSSP) Single source shores pah problem: Given a weighed graph G and a designaed node s G, deermine δ(s, u) for each u G. Disallow negaive edges Could use Flod-Warshall, bu is here a more efficien wa? s Problem 1 2 5 Pah sequence of edge-conneced verices Pah lengh sum of edge lenghs Shores pah pah beween endpoins wih minimum oal lengh (SSSP) Given graph G and source vere s, calculae lengh of shores pah from source s o each vere in G. KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 11 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 12 / 1

Idea s Inpus (lef): 1 2 5 s 0 5 1 2 5 G: graph wih nonnegaive (imporan!) edges s: sar node Oupus (righ): Compue for each node v, δ(s, v) = lengh shores pah from s o v ( if none). Shown inside nodes. 8 Begin wih a crude esimae d[u] for δ(s, u): { 0 if u = s d[u] = oherwise Refine esimaes using (carefull chosen) sequence of he following edge operaions (i.e. (u, v) mus be an edge): Ulimael (we hope) d[u] = δ(s, u), for all u. KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1 Noes Observaion Through an sequence of Rela(u, v) seps d[] is non-increasing, and If d[], hen here is a pah of lengh d[] in G from s o. Algorihm Dijksra(G, s ): Iniialie d(s) o 0 Iniialie d() = INFTY for all s Creae priori queue Q and place each node in Q wih ke value d() while Q is no emp do u Q.remove min elemen() for each v in G.neighbours(u) do Rela(u, v) KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 15 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1

Priori queue refresher D s algorihm in acion Wha Conainer absracion holding ke, value pairs Operaions inser Add new ke value iem o conainer min Reurn he value wih he smalles ke (ies broken arb.) remove min Reurn and remove he value wih he smalles ke Implemenaion Heap-ordered ree sored in arra; inser, remove min O(log n) ime. s 0 5 1 2 5 Algorihm Dijksra(G, s ):... while Q is no emp do u Q.remove min elemen() for each v in G.neighbours(u) do Rela(u, v) 1 8 Q vere non-q vere u vere KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 18 / 1 Aside Running ime of D s algorihm Rela involves changes o d[] i.e. priori queue kes. New priori queue operaion: reduce ke(, k) Replace ke of iem wih smaller ke k Implemenaion noe: Effecivel helper mehod heap decrease ke used in inser operaion Running ime: O(log(queue sie)) Algorihm Dijksra(G, s ): / Iniialiaion suff / while Q is no emp do u Q.remove min elemen() for each v in G.neighbours(u) do Rela(u, v) n, m = num. nodes, edges Priori queue operaions: O((n + m) log n) (over) Non-priori queue suff: O(n + m) Toal running ime: O((n + m) log n) KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 1 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 20 / 1

Noes Priori queue operaions op no. cos per suboal inser n O(log n) O(n log n) isemp n O(1) O(n) remove min elemen n O(log n) O(n log n) replaceke m O(log n) O(m log n) Non-priori queue suff n ieraions in all for fied u, for-loop akes O(#edges leaving u) ime Toal O(n) + O(#edges leaving u) = O(n + m) }{{} u V while } {{ } for O((n + m) log n) + O(n + m) = O((n + m) log n) KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 21 / 1 1 Definiion We sa is seled once d() = δ(s, ). If u is seled and s u v is a shores pah o v, hen following Rela(u, v) v is also seled Before: Rela(u, v), d(u) = δ(s, u) Afer: Rela(u, v), d(v) d(u) + w(u, v) This mus equal δ(s, v): shores pah assumpion KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 22 / 1 2 Node u is seled before being removed from Q. Proof. Suppose his were no rue Le u be he firs node removed from Q ha was no seled Le be firs node along shores pah from s o u ha is in Q and be is predecessor KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 2 / 1 2 con d Node u is seled before being removed from Q. d(u) d() b remove min elemens choice of u = δ(s, ) no in Q so d() = δ(s, ); Rela(, ) operaion ensures ha d() = δ(s, ) δ(s, u) since s-o- a prefi of s-o-u and edge-weighs are non-negaive d(u) KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 2 / 1 Hence d(u) = δ(s, u)

Consrucing he Pahs SP Algorihms and Nework Rouing Minor weak o Rela o record shores-pah predecessors so algorihms consrucs pahs no jus heir lengh. p[v] u A conclusion, p() indicaes paren of in a (shores-pah) ree rooed a s. The roo o leaf pah o is a shores pah. KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 25 / 1 nework of hoss/swiches(nodes) and links (edges) edge weigh desirabili of using edge Deermine for/a each node, he lowes cos roue o each desinaion Would like approach o be disribued resilien o failures/changes KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 2 / 1 Idea 1 Idea 2 Each node deermines is neighbours/edges and coss and injecs ino ino nework. (Re-injecs following changes) Nodes echange his informaion among hemselves Each node ges complee map of he nework Changes ge refleced in maps as new info replaces old Each node runs Dijksra locall o esablish bes pahs from o oher nework nodes Mainains able of (des., cos, ne-hop) enries for rouing decisions Informaion re-compued when nework map changes KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 2 / 1 KH (21/10/1) Lecure I: Shores Pah Algorihms Ocober 201 28 / 1