sources for this lecture 2 shortest paths and minimum
play

Sources for this lecture 2. Shortest paths and minimum spanning - PowerPoint PPT Presentation

S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 1 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 3 Sources for this lecture 2. Shortest paths and minimum spanning trees The material for this


  1. ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 1 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 3 Sources for this lecture 2. Shortest paths and minimum spanning trees The material for this lecture has been prepared with the help of [Jun, Chapters 3–4], [Cor, Chapters 24–26], [Wes, Section 2.3], and Let G be a (di)graph and let w : E ( G ) → R . the following references: [Che] B. V. Cherkassky and A. V. Goldberg, Negative- The number w ( e ) is the weight of an edge e ∈ E ( G ). cycle detection algorithms, Math. Program. 85 The pair ( G, w ) is a network (or a weighted (di)graph ). (1999) 277–311. (Online in Springer LINK.) [Pr¨ o] H. J. Pr¨ omel and A. Steger, The Steiner Tree Prob- The weight of an edge in a network may be interpreted as length, lem , Friedr. Vieweg & Sohn, Braunschweig, 2002. delay, probability, cost/profit, exchange rate, . . . [Tar] R. E. Tarjan, Data Structures and Network Algo- Edge weights may also be negative. rithms , Society for Industrial and Applied Mathe- matics (SIAM), Philadelphia PA, 1983. ✫ ✪ ✫ ✪ c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006 ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 2 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 4 Distance in networks In this lecture we study the following two problems together with a number of related problems. Throughout this section (i.e. until but not including the part on shortest path : Given digraph G , a weight function w , and minimum spanning trees) we assume that G is a simple digraph two vertices a, b ∈ V ( G ) as input, determine a shortest path without loops. (i.e. a path of the minimum possible total weight) from a to Let ( G, w ) be a network and let W = ( e 1 , . . . , e n ) be a walk in G . b , or conclude that none exists. The weight (or length ) of W is minimum spanning tree : Given a connected graph G and a weight function w as input, determine a spanning tree for G w ( W ) := w ( e 1 ) + . . . + w ( e n ) . that has the minimum total weight among all spanning trees for G . The distance d ( a, b ) between two vertices a and b in a network is the minimum length of a path from a to b taken over all such paths. If A generalization of these two problems is the Steiner tree problem, no such path exists, we set d ( a, b ) = ∞ . The empty path always has which we will discuss briefly at the end of this lecture. ✫ ✪ ✫ weight zero. ✪ c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006

  2. ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 5 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 7 Negative-weight edges Properties of shortest paths In general, the shortest path problem for arbitrary networks ( G, w ) Theorem A.15 Let ( G, w ) be a network without negative cycles and with negative edge weights is NP -hard. let W be a walk from a to b . Then, there exists a path P from a to b that satisfies w ( P ) ≤ w ( W ) . This is because a longest path in ( G, w ) is a shortest path in ( G, − w ). The problem of determining whether a graph contains a Proof: If W does not contain repeated vertices, we are done. long path is NP -complete. More specifically, the problem Otherwise, let ( e j , e j +1 , . . . , e k ), where e i = v i v i +1 ∈ E ( G ) for all j ≤ i ≤ k , be a subwalk of W for which all the vertices v i are hamiltonian path (decision) : Given a graph G as input, pairwise distinct except that v j = v k +1 . Such a subwalk is clearly a decide whether G contains a spanning path. cycle, and hence has nonnegative weight. By removing this cycle from W we obtain a walk from a to b whose weight is at most the is NP -complete, and remains so when restricted to graphs with only weight of W and with one less repeated vertex pair. Since walks are two vertices of degree one. Thus, an algorithm for shortest path finite, iterating this construction eventually gives us a path P from a on arbitrary networks enables us to solve hamiltonian path ✫ ✪ ✫ to b with w ( P ) ≤ w ( W ). � ✪ (decision) . c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006 ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 6 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 8 Theorem A.16 Let ( G, w ) be a network without negative cycles and let P be a shortest path from a to b . Then, any subpath P cd of P from c to d is a shortest path from c to d . Good algorithms for shortest path are known only in cases where Proof: To reach a contradiction, suppose that P cd is not a shortest the network does not contain cycles of negative weight ( negative path from c to d . Then, there exists a path P ′ cd from c to d that cycles ). satisfies w ( P ′ cd ) < w ( P cd ). Denote by P ac and P db the subpaths of P from a to c and from d to b , respectively. Now, the walk Detecting (and finding) negative cycles is relevant in several W ′ = P ac + P ′ cd + P db satisfies applications. For an example of an application in locating w ( W ′ ) = w ( P ac )+ w ( P ′ opportunities for arbitrage, see [Cor, Exercise 25-3]. cd )+ w ( P db ) < w ( P ac )+ w ( P cd )+ w ( P db ) = w ( P ) . By Theorem A.15 there exists a path P ′ from a to b that satisfies w ( P ′ ) ≤ w ( W ′ ), which is a contradiction since P is a shortest path from a to b . Thus, P cd is a shortest path from c to d . � ✫ ✪ ✫ ✪ c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006

  3. ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 9 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 11 Properties of the labeling method Corollary A.3 Let ( G, w ) be a network without negative cycles. Then, for any two vertices s, b ( s � = b ), Lemma A.1 The labeling method maintains the invariant that there d ( s, b ) = min { d ( s, a ) + w ( ab ) : a ∈ N − ( b ) } . exists a walk W from s to v with w ( W ) = d [ v ] . Proof: By induction on the number of labeling steps. � Proof: The claim clearly holds if b is not accessible from s . Otherwise, a shortest path P from s to b has to contain a last edge Lemma A.2 When the labeling method halts, w ( W ) ≥ d [ v ] for any ab . By Theorem A.16, the subpath P sa from s to a is a shortest path. walk W from s to v . Consequently, d ( s, b ) = w ( P ) = w ( P sa ) + w ( ab ) = d ( s, a ) + w ( ab ). � Proof: By induction on the number of edges in W . � ✫ ✪ ✫ ✪ c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006 ✬ ✩ ✬ ✩ S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 10 S-72.2420 / T-79.5203 Shortest paths and minimum spanning trees 12 The labeling method Theorem A.17 When the labeling method halts, d [ v ] is the length of a shortest path from s to v if v is reachable from s ; otherwise, d [ v ] = ∞ . If there is a negative cycle reachable from s , the method The labeling method was discovered by Ford (1956, 1962). The never halts. exposition here follows [Tar, Chapter 7]. The labeling method takes as input a network ( G, w ) and a source vertex s ∈ V ( G ). Proof: If G contains a negative cycle reachable from s , there are arbitrarily short walks from s to any vertex in the cycle. Thus, the The method maintains a tentative distance d [ v ] and a tentative labeling method cannot halt in the presence of negative cycles parent vertex p [ v ] for each vertex v ∈ V ( G ). Initially p [ v ] = undef because this would contradict Lemma A.2. and d [ v ] = ∞ for all v ∈ V ( G ), with the exception of d [ s ] = 0. Hence, there are no negative cycles reachable from s if the labeling The method performs a series of labeling steps : method halts. Consequently, to any shortest walk there is a path of Select an edge ab ∈ E ( G ) such that d [ a ] + w ( ab ) < d [ b ]. the same length by Theorem A.15. So, by Lemmata A.1 and A.2, Put d [ b ] ← d [ a ] + w ( ab ) and p [ b ] ← a . d [ v ] < ∞ is the length of a shortest path from s to v ; moreover, d [ v ] = ∞ if and only if v is not reachable from s . � ✫ When no labeling step can be performed, the method halts. ✪ ✫ ✪ c c 09. 04. 08 � Petteri Kaski 2006 09. 04. 08 � Petteri Kaski 2006

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend