Examples and applications on SSSP and MST

Similar documents
Minimum Spanning Trees

10. EXTENDING TRACTABILITY

Analysis of Algorithms - Elementary graphs algorithms -

Week 3: Connected Subgraphs

Analysis of Algorithms - Elementary graphs algorithms -

Final Exam Solutions

CS 491 G Combinatorial Optimization

Chapter Finding Small Vertex Covers. Extending the Limits of Tractability. Coping With NP-Completeness. Vertex Cover

Abstract Interpretation: concrete and abstract semantics

Y 0. Standing Wave Interference between the incident & reflected waves Standing wave. A string with one end fixed on a wall

Strongly Connected Components

64. A Conic Section from Five Elements.

Derangements and Applications

Basic Polyhedral theory

Searching Linked Lists. Perfect Skip List. Building a Skip List. Skip List Analysis (1) Assume the list is sorted, but is stored in a linked list.

1 Minimum Cut Problem

Mathematics 1110H Calculus I: Limits, derivatives, and Integrals Trent University, Summer 2018 Solutions to the Actual Final Examination

The second condition says that a node α of the tree has exactly n children if the arity of its label is n.

Additional Math (4047) Paper 2 (100 marks) y x. 2 d. d d

Recounting the Rationals

Where k is either given or determined from the data and c is an arbitrary constant.

cycle that does not cross any edges (including its own), then it has at least

On spanning trees and cycles of multicolored point sets with few intersections

priority queue ADT heaps 1

Combinatorial Networks Week 1, March 11-12

Network Congestion Games

Search sequence databases 3 10/25/2016

Walk Like a Mathematician Learning Task:

Homework #3. 1 x. dx. It therefore follows that a sum of the

Finding low cost TSP and 2-matching solutions using certain half integer subtour vertices

SCHUR S THEOREM REU SUMMER 2005

First derivative analysis

The Transfer Function. The Transfer Function. The Transfer Function. The Transfer Function. The Transfer Function. The Transfer Function

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Thomas Whitham Sixth Form

The Equitable Dominating Graph

Minimum Spanning Trees

CSI35 Chapter 11 Review

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

First order differential equation Linear equation; Method of integrating factors

Approximate Maximum Flow in Undirected Networks by Christiano, Kelner, Madry, Spielmann, Teng (STOC 2011)

Supplementary Materials

COHORT MBA. Exponential function. MATH review (part2) by Lucian Mitroiu. The LOG and EXP functions. Properties: e e. lim.

On the Hamiltonian of a Multi-Electron Atom

ECE602 Exam 1 April 5, You must show ALL of your work for full credit.

a 1and x is any real number.

EXST Regression Techniques Page 1

2008 AP Calculus BC Multiple Choice Exam

Square of Hamilton cycle in a random graph

On the irreducibility of some polynomials in two variables

Calculus II (MAC )

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

Recall that by Theorems 10.3 and 10.4 together provide us the estimate o(n2 ), S(q) q 9, q=1

SOME PARAMETERS ON EQUITABLE COLORING OF PRISM AND CIRCULANT GRAPH.

Computing and Communications -- Network Coding

Solution: APPM 1360 Final (150 pts) Spring (60 pts total) The following parts are not related, justify your answers:

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

CPSC 665 : An Algorithmist s Toolkit Lecture 4 : 21 Jan Linear Programming

MA1506 Tutorial 2 Solutions. Question 1. (1a) 1 ) y x. e x. 1 exp (in general, Integrating factor is. ye dx. So ) (1b) e e. e c.

N1.1 Homework Answers

Steinberg s Conjecture is false

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH.

4. (5a + b) 7 & x 1 = (3x 1)log 10 4 = log (M1) [4] d = 3 [4] T 2 = 5 + = 16 or or 16.

Multiple Short Term Infusion Homework # 5 PHA 5127

General Caching Is Hard: Even with Small Pages

TEMASEK JUNIOR COLLEGE, SINGAPORE. JC 2 Preliminary Examination 2017

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

Thomas Whitham Sixth Form

Introduction to the Fourier transform. Computer Vision & Digital Image Processing. The Fourier transform (continued) The Fourier transform (continued)

BINOMIAL COEFFICIENTS INVOLVING INFINITE POWERS OF PRIMES

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

y cos x = cos xdx = sin x + c y = tan x + c sec x But, y = 1 when x = 0 giving c = 1. y = tan x + sec x (A1) (C4) OR y cos x = sin x + 1 [8]

Gradebook & Midterm & Office Hours

The van der Waals interaction 1 D. E. Soper 2 University of Oregon 20 April 2012

Correlation in tree The (ferromagnetic) Ising model

Addition of angular momentum

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

4 x 4, and. where x is Town Square

22/ Breakdown of the Born-Oppenheimer approximation. Selection rules for rotational-vibrational transitions. P, R branches.

ECE 2210 / 00 Phasor Examples

Random Process Part 1

UNTYPED LAMBDA CALCULUS (II)

CS553 Lecture Register Allocation I 3

MCB137: Physical Biology of the Cell Spring 2017 Homework 6: Ligand binding and the MWC model of allostery (Due 3/23/17)

1 Solving Flow Problems using Multiplicative Weights

COMP108 Algorithmic Foundations

CLONES IN 3-CONNECTED FRAME MATROIDS

3) Use the average steady-state equation to determine the dose. Note that only 100 mg tablets of aminophylline are available here.

6.1 Integration by Parts and Present Value. Copyright Cengage Learning. All rights reserved.

MATHEMATICS (B) 2 log (D) ( 1) = where z =

A. Limits and Horizontal Asymptotes ( ) f x f x. f x. x "±# ( ).

Optimizing Product Launches in the Presence of Strategic Consumers Appendix

Junction Tree Algorithm 1. David Barber

5. B To determine all the holes and asymptotes of the equation: y = bdc dced f gbd

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems

Alpha and beta decay equation practice

1997 AP Calculus AB: Section I, Part A

Differential Equations

Some remarks on Kurepa s left factorial

Transcription:

Exampls an applications on SSSP an MST Dan (Doris) H & Junhao Gan ITEE Univrsity of Qunslan COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Dijkstra s Algorithm Th algorithm solvs th singl-sourc shortst-paths (SSSP) problm on a irct graph G = (V, E) with positiv g wights. Lt V V b th currnt st of vrtics whos shortst paths from th sourc vrtx s hav bn foun an S = V \V. Th crucial part of th algorithm is th g rlaxation ia. Essntially, it is to maintain, for ach v S, th currnt shortst istanc from s only through th vrtics in V. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Suppos that th sourc vrtx is a. vrtx v ist(v) parnt(v) a 0 nil b nil c nil nil nil f nil g nil h nil V = an S = {a, b, c,,, f, g, h, i}. i nil Sinc ist(a) is th smallst among thos of vrtics in S, pick a. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of a: vrtx v ist(v) parnt(v) a 0 nil b 2 nil a c nil nil nil f nil g nil h nil V = {a} an S = {b, c,,, f, g, h, i}. i nil Th currnt shortst istanc of b from a only through th vrtics in V is upat. Aftr thn, ist(b) is th smallst among thos of vrtics in S. Pick b. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of b: vrtx v ist(v) parnt(v) a 0 nil b 2 a c nil 5 nil b nil f nil g nil h nil V = {a, b} an S = {c,,, f, g, h, i}. i nil Similarly, upat th currnt shortst istanc of from a only through th vrtics in V. An ist() is th smallst among thos in S. Pick. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of : vrtx v ist(v) parnt(v) a 0 nil b 2 a c 12 nil 5 b 6 nil f nil g nil h nil V = {a, b, } an S = {c,, f, g, h, i}. i nil Sinc aftr th upats, ist() is th smallst among thos in S, pick. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of : V = {a, b,, } an S = {c, f, g, h, i}. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 12 5 b 6 f 7 nil g nil h nil i nil COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of f : V = {a, b,,, f } an S = {c, g, h, i}. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 12 10 f 5 b 6 f 7 g nil h 11 nil f i nil COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of c: V = {a, b, c,,, f } an S = {g, h, i}. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 10 f 5 b 6 f 7 g nil h 11 f i nil COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of h: V = {a, b, c,,, f, h} an S = {g, i}. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 10 f 5 b 6 f 7 g 12 nil h h 11 f i 15 nil h COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of g: V = {a, b, c,,, f, g, h} an S = {i}. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 10 f 5 b 6 f 7 g 12 h h 11 f i 15 14 h g COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Rlax th out-going gs of i: V = {a, b, c,,, f, g, h, i} an S = {}. Don. vrtx v ist(v) parnt(v) a 0 nil b 2 a c 10 f 5 b 6 f 7 g 12 h h 11 f i 14 g COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Prim s Algorithm Th algorithm grows a tr T mst by incluing on vrtx at a tim. At any momnt, it ivis th vrtx st V into two parts: Th st S of vrtics that ar alray in T mst. Th st of othr vrtics: V \S At th n of th algorithm, S = V. If an g conncts a vrtx in V an a vrtx in V \S, w call it an xtnsion g. At all tims, th algorithm nforcs th following lightst xtnsion principl: For vry vrtx v V \S, it rmmbrs which xtnsion g of v has th smallst wight rfrr to as th lightst xtnsion g of v, an not as bst-xt(v). COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {a, c} is th lightst of all. S = {a, c}. Th MST has on g {a, c}. vrtx v bst-xt(v) an wight a b {b, a}, 4 c {, c}, 2 nil, f {f, c}, 10 g nil, h nil, i nil, COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {, c} is th lightst of all. S = {a, c, }. A g {, c} into th MST. vrtx v bst-xt(v) an wight a b {b, a}, 4 c {, }, 3 f {f, c}, 10 g {g, }, 6 h nil, i nil, COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {, } is th lightst of all. S = {a, c,, }. A g {, } into th MST. vrtx v bst-xt(v) an wight a b {b, a}, 4 c f {f, }, 5 g {g, }, 6 h nil, i nil, COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {b, a} is th lightst of all. S = {a, c,,, b}. A g {b, a} into th MST. vrtx v bst-xt(v) an wight a b c f {f, }, 5 g {g, }, 6 h nil, i nil, COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {f, } is th lightst of all. S = {a, c,,, b, f }. A g {f, } into th MST. vrtx v bst-xt(v) an wight a b c f g {g, }, 6 h {h, f }, 12 i nil, COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {g, } is th lightst of all. S = {a, c,,, b, f, g}. A g {g, } into th MST. vrtx v bst-xt(v) an wight a b c f g h {h, f }, 12 i {i, g}, 8 COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Eg {i, g} is th lightst of all. S = {a, c,,, b, f, g, i}. A g {i, g} into th MST. vrtx v bst-xt(v) an wight a b c f g h {h, i}, 3 i COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl At th n, g {h, i} is th lightst of all. S = {a, c,,, b, f, g, i, h}. A g {h, i} into th MST an w gt th final MST. vrtx v bst-xt(v) an wight a b c f g h i COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Facility Allocation Application of Dijkstra s Algorithm Lt G = (V, E) b an unirct graph with positiv g wights, whr ach vrtx v V rprsnts ithr a usr or a facility. For a usr u an a facility f, th istanc btwn u an f is th shortst istanc from u to f on G not by ist(u, f ). Our goal is to assign th narst facility f to ach usr u such that: Thr is no facility f f such that ist(f, u) < ist(f, u). Furthrmor, w say f = narst-fac(u). COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl Givn a graph blow, f i (for i [1, 4]) rprsnts a facility an u j (for j [1, 4]) rprsnts a usr. u 1 Thn w hav: narst-fac(u 1 ) = f 2, narst-fac(u 2 ) = f 3, narst-fac(u 3 ) = f 1, narst-fac(u 4 ) = f 1. 5 8 f 2 7 2 4 10 u 4 9 6 f 1 u 3 3 8 7 f 4 10 f 3 1 2 u 2 COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Facility Allocation Application of Dijkstra s Algorithm To solv th problm, th most trivial way is to run on Dijkstra s algorithm for ach facility. An thn, for ach usr u, pick th facility f with ist(f, u) smallst. Howvr, w can o much bttr. In fact, only on Dijkstra is nough! COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Facility Allocation Application of Dijkstra s Algorithm Th algorithm is as follows: A an auxilary vrtx s to G. Crat an g {s, f } for ach facility f with g wight α, whr α > 0 is smallr than any g wight in G. Prform Dijkstra s algorithm with sourc vrtx s on th augmnt graph. In th rsult SSSP tr, for ach facility f, assign f to ach usr in th subtr of f. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl 0.5 s s u 1 5 8 f 2 7 2 4 10 u 4 9 6 f 1 u 3 3 8 7 0.5 f 4 2 10 1 f 3 u 2 0.5 0.5 f 1 f 2 f 3 f 4 u 3 u 4 u 1 u 2 COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Corrctnss Th corrctnss of th algorithm follows th facts blow: All th nos at lvl-1 (assum s is at lvl-0) in th SSSP tr ar th facility vrtics. All th usr nos u in th subtr of a facility f satisfy: ist(f, u) ist(f, u) for all facilitis f f. A short proof for th scon bullt: Suppos that thr os xist a facility f such that ist(f, u) < ist(f, u). Thn th path from s to u through f is shortr than that through f. It contraicts with th fact that u is in th subtr of f in th SSSP tr. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Travling Salsman Application of MST Givn a wight unirct graph G = (V, E) satisfying th followings: G is complt: for u, v V, {u, v} is in E. Th wight of ach g is positiv. All th wights satisfy th triangl inquality: w(u, v) w(u, x) + w(x, v) for u, v, x V, whr w(u, v) is th wight of g {u, v}. Th Travling Salsman Problm (TSP) is to fin a rout H such that: H is a cycl. Each vrtx v V is visit by H onc an xactly onc. Th total wight of th gs on H is smallst. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Exampl a a b f g b f g c h c h For simpl illustration, w show th input graph on th lft without rawing all th gs xplicitly. Insta, w mb th graph on th plan such that th wight of ach g is th uclian istanc btwn its two n points. Th r cycl shown on th right is th optimal solution H. Th TSP problm is NP-har! COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Travling Salsman Application of MST For a cycl H in th input graph, not th total wight of gs on H by w(h). In th following, w will introuc a 2-approximat algorithm for th TSP problm in th sns that it always fins a solution H with w(h) 2 w(h ), whr H is th optimal solution. COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Comput an MST T of G. Prform DFS on T from an arbitrary no an rcor th no visiting squnc S: a, b, c, b, h, b, a,,, f,, g,,, a. Only kp th first occurrnc of ach vrtx in th squnc S: a, b, c, h,,, f, g. c a b a h f g Lt H b th rout of this first occurrnc squnc. Rturn H as an approximat solution. c b h f g W claim that w(h) 2 w(h ). COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST

Proof sktch: Sinc H is a cycl on all th vrtics, rmoving any g from H will rsult to a spanning tr T. As all th g wights ar positiv an T is an MST, w hav w(t ) w(t ) < w(h ). Sinc th DFS travrss ach g of T only twic, th total wight of all th gs on th visit squnc S, not by w(s), is 2 w(t ). Consir any two conscutiv vrtics u an v on H. By th triangl inquality, w know that w(u, v) is no mor than th total wight of all th gs on th sub-squnc of S btwn thir first occurrnc. Thrfor, w(h) w(s) = 2 w(t ) < 2 w(h ). COMP3506/7505, Uni of Qunslan Exampls an applications on SSSP an MST