on the difficulty of some shortest paths problems

37
On the Difficulty of Some Shortest Paths Problems Amit Bhosle Department of Computer Science University of California, Santa Barbara

Upload: vangie

Post on 14-Jan-2016

51 views

Category:

Documents


0 download

DESCRIPTION

On the Difficulty of Some Shortest Paths Problems. Amit Bhosle Department of Computer Science University of California, Santa Barbara. Overview : What We Will Discuss Today. Introduction – Replacement Paths : the central problem Motivation Upper bounds : - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: On the Difficulty of Some Shortest Paths Problems

On the Difficulty of Some Shortest Paths Problems

Amit Bhosle

Department of Computer Science

University of California, Santa Barbara

Page 2: On the Difficulty of Some Shortest Paths Problems

Overview : What We Will Discuss Today

• Introduction – Replacement Paths : the central problem

• Motivation

• Upper bounds :– Undirected : O(1) single source shortest paths computation [HS01]

– Directed : O(1) all pair shortest paths computation

• Lower bounds :– All pair shortest paths (APSP) [KKP]

– N-pairs shortest paths (NPSP)

– Replacement paths problem

– Related problems

• Conclusion

Page 3: On the Difficulty of Some Shortest Paths Problems

The Replacement Paths Problem

• Given a weighted graph G(V,E), two nodes s and t, and a shortest • path P = {s=v0 , v1 , v2 ,…,vk=t} from s to t.

• Find the shortest path from s to t in the graphs :– Edge version : G - {ei} for all 0 i k where ei = {vi , vi+1}– Node version : G - {vi} for all 0 < i < k .

• G assumed to be 2-connected.• G may be directed or undirected.• We focus on the edge version (lower bounds hold for node version).

Page 4: On the Difficulty of Some Shortest Paths Problems

Why Study the Replacement Paths Problem ?

Applications :

– Computational mechanism design (VCG auctions).

payment(e) = d (s,t ; G \ e) – d (s,t ; G |w(e)=0 )

Weight of thereplacement path for e Needs constant time per edge after an initial

single source shortest path computation

Payments need to be computed for all edges of the ( s, t ) shortest path.

Page 5: On the Difficulty of Some Shortest Paths Problems

Why Study the Replacement Paths Problem ? (Contd.)

Applications :

– Network routing for single link failure recovery.

– Directly yields the Most Vital Edge in the shortest path domain.

– Sub-problem in other problems e.g. K - Shortest paths.

Page 6: On the Difficulty of Some Shortest Paths Problems

Naïve Algorithm

• Recompute : Compute the s - t shortest paths separately in each of the k graphs.

G - {ei } for all 1 i < k.

• Time Complexity : Since k = O(n) in worst case, the naïve algorithm may require O( n (m+n log n) ) time.

• Simple, but inefficient (at least) for undirected graphs.

Page 7: On the Difficulty of Some Shortest Paths Problems

Upper Bounds

• Undirected edge version solved recently by Hershberger and Suri [HS01] in O(m + n log n) time.

• Nardelli, et al. [NPW01] solved the node version in the same time bounds.

• Directed version can be solved in O(APSP) time. – In some models, the All Pairs Shortest Paths problem can be

solved in sub-cubic time whereas the naïve algorithm may still be cubic in the worst case.

Page 8: On the Difficulty of Some Shortest Paths Problems

Undirected Version Upper Bound [Hershberger-Suri]

s te

p

Lemma : If p Vt|e , path(p,t) cannot contain e

Vt|eVs|e

q

Page 9: On the Difficulty of Some Shortest Paths Problems

Undirected Version Upper Bound (Contd.)

s te

Vt|eVs|e u

v

Weight of the path using edge (u,v) is :d (s,u) + w (u,v) + d (v,t)

Ee

Page 10: On the Difficulty of Some Shortest Paths Problems

Undirected Version Upper Bound (Contd.)

• Assign cost to each edge (u,v) E(Vs|e ,Vt|e) as :

cost (u,v) = d(s,u) + w(u,v) + d(v,t)

• Immediately suggests an algorithm : (weight of) the replacement path for the edge e is

MIN(u,v) : u Vs|e, v Vt|e{ cost(u,v) }

• But, arbitrarily computing these values could yield no improvement – there can be (m) edges in each cut !

Page 11: On the Difficulty of Some Shortest Paths Problems

Undirected Version Upper Bound (Contd.)

• From Ei , delete edges ending at vi+1 and add edges starting at vi+1 to get Ei+1 : we need O ( deg(v i+1)) heap operations.

• Standard heap implementation yields an O(m log n) algorithm.

A slightly modified algorithm using F-Heaps runs in O(m+n log n) time.

s tei ei+1

vi vi+1

Page 12: On the Difficulty of Some Shortest Paths Problems

Difficulty in Directed Version

s te

vVt|e

Vs|e

The basic lemma does not hold for digraphs : Even though v Vt|e , path(v,t) contains edge e .

Page 13: On the Difficulty of Some Shortest Paths Problems

Directed Replacement Paths : O(APSP)

• The naïve algorithm requires O( k (m+n log n )), where k is the number of edges on the shortest path.

• We present an algorithm which runs in O(k.n) time after an initial APSP computation.

• APSP has the trivial lower bound of (n 2) and k is at most n-1. Thus, the running time remains dominated by the APSP computation.

Page 14: On the Difficulty of Some Shortest Paths Problems

Directed Replacement Paths : O(APSP) (Contd.)

We start by computing the All Pairs Shortest Paths in G \ P(s,t)where P = {e0 , e2 ,…, ek-1 } is the shortest path from s to t .

s=v0t=vk

v

ei

Vs|i

vj vj+1

Page 15: On the Difficulty of Some Shortest Paths Problems

Directed Replacement Paths : O(APSP) (Contd.)

• For any edge ei , Vs|i can be constructed in O(n) time.

• The best path through a node v Vi is :

path v (s,t | i ) = MIN kj = i+1 { d(s,v ) + d(v,vj ) + d(vj ,t ) }.

We shall see later that this can be done in constant time per node.

• The replacement path for the edge ei is :

MIN v V s|i { path v (s,t | i ) }.

This requires O(n) time per edge on P, since | Vi | is O (n).

Page 16: On the Difficulty of Some Shortest Paths Problems

Directed Replacement Paths : O(APSP) (Contd.)

s=v0t=vk

v

ei

ei+1

We compute the replacement paths for ei before ej for i > j.

path v (s,t | i ) = MIN { path v (s,t | i+1 ) ,

d(s,v ) + d(v ,vi+1 ) + d(vi+1 ,t ) }

vi+1

Page 17: On the Difficulty of Some Shortest Paths Problems

Directed Replacement Paths : O(APSP) (Contd.)

• Time required remains dominated by the initial APSP computation.

(All other steps together require O (n 2) )

• Implies an O(k.APSP) time algorithm for the k-shortest paths.

• O ( APSP ) :

– Fast matrix multiplication :

O(n3 (log log n / log n)) ; O(C0.681 n2.575 ).

– Comparison based : O ( n ( m + n log n) )

Page 18: On the Difficulty of Some Shortest Paths Problems

All Pairs Shortest Paths Lower Bound [Karger-Koller-Phillips]

n nm / n

Any algorithm must compare all the mn paths.

Otherwise, some modification of edges enables us to fool the algorithm.

Page 19: On the Difficulty of Some Shortest Paths Problems

N-Pairs Shortest Paths (NPSP)

n nm / n

Any algorithm must investigate all the (m n ) tripleswhere m = O (n n)

We shall reduce an NPSP instance to a Replacement Paths problem instance, thus applying the lower bound of the former to the latter.

Page 20: On the Difficulty of Some Shortest Paths Problems

Replacement Paths Lower Bound

• The lower bound is based on the n-pairs shortest paths lower bound.

• Some restrictions need to be imposed since the NPSP lower bound is not sufficiently robust. But still includes all known algorithms.

• Reduction basically says that an O (T (m,n)) algorithm for the replacement paths implies an O (T (m,n)) algorithm for NPSP.

Page 21: On the Difficulty of Some Shortest Paths Problems

Replacement Paths Lower Bound (Contd.)

vi vi+1

H

s t

(i+1).W(n-i).W

W = nemax

emax H

sjtj

0 0000 0 0

(n-k).W p.W

Page 22: On the Difficulty of Some Shortest Paths Problems

Replacement Paths Lower Bound (Contd.)

• Crucial property : Replacement path for edge ei = {vi ,vi+1} leaves the spine P at vi , enters H at sj , leaves H at tj and joins back at vi+1.

• That is, each replacement path in G computes an (sj ,tj ) distance in H.

• The reduction is linear time and does not increase the input complexity.

• NPSP has a (weak) lower bound of (m n). With some restrictions, we apply the lower bound to the replacement paths problem.

Page 23: On the Difficulty of Some Shortest Paths Problems

Lower Bounds on Related Problems

Similar bounds on some problems closely related to the replacement paths problem :

– K-shortest paths : (m n) per output path.

– <Length> <hop count> metric : (m n).

– Subpaths deletions : (m k) for k subpaths deleted.

– Replacement SP trees : (mn).

Page 24: On the Difficulty of Some Shortest Paths Problems

K-Shortest Paths

• Given a digraph G, and two nodes s and t , and an integer k, one needs to find k shortest paths from s to t in order of increasing weights.

• All known algorithms for k-SP use replacement paths as a subroutine : note that the shortest replacement path is the second shortest path from s to t.

– Basic idea : ith shortest path differs from all the i -1 shorter paths in atleast one edge. Thus, new candidates are generated by finding the replacement paths for these shorter paths.

Page 25: On the Difficulty of Some Shortest Paths Problems

K-Shortest Paths (Contd.)

• Typically, all the algorithms for the k-SPs invoke one replacement paths subroutine per output path.

• Thus, the lower bound of (m n) applies to all algorithms for the k-SPs which use replacement paths as a subroutine.

• Is it possible to determine the shortest replacement path without computing all the replacement paths for a given shortest path ?

• The non-simple k-SPs can be computed in O(m + n log n + k) time using a technique not based on replacement paths.

Page 26: On the Difficulty of Some Shortest Paths Problems

<length> <hop count>

• Ties among shortest paths are sometimes broken in favor of the one with fewer edges.

• Archer & Tardos suggested the <length> <hop count> metric for replacement paths. This metric also favors paths with fewer edges.

• A slight modification in the basic construction allows us to establish a lower bound of (m n) for computing replacement paths with this metric.

Page 27: On the Difficulty of Some Shortest Paths Problems

<length> <hop count> (Contd.)

vi vi+1

H

s

(i+1)W(n-i)W

W = nemaxsj

tj

0 0000 0

vn

0

v3n=t

Page 28: On the Difficulty of Some Shortest Paths Problems

<length> <hop count> (Contd.)

Weight of a path with d detours with detour r skipping kr edges of P is exactly equal to :

(3n + 4d - kr ) {(dn + kr )W + lr }

No. of edges Weight of the path

Thus, the metric is minimized when d = 1.If this detour skips k edges, the weight of the path becomes (3n + 4 - k ) {(n+k)W + l }

Thus, k = 1 for optimal replacement path and again, each replacement path computes an (si ,tj ) distance in H.

Page 29: On the Difficulty of Some Shortest Paths Problems

Replacement Shortest Paths Trees

• Given a digraph G, a node s, and the shortest paths tree Ts = {e1 ,e2 ,…, en-1} of s in G, compute the shortest path tree of s in each of the n-1 graphs G \ ei .

• Naïve algorithm :

Recompute - compute the shortest path tree of s in each of the.

Graphs G \ ei for all 1 i n-1.

• Time complexity : O (mn + n2 log n).

• We prove a lower bound of (mn) for this problem.

Page 30: On the Difficulty of Some Shortest Paths Problems

Replacement Shortest Paths Trees (Contd.)

vi t = vn

H

0

(n-i).W

W = n.emax

Si

0 0000 0 0

Sn

s = v0

Sk

vk

(n-k).W

0

Page 31: On the Difficulty of Some Shortest Paths Problems

Replacement Shortest Paths Trees (Contd.)

• Crucial properties :

– The shortest path tree in G of s = v0 contains the shortest path tree of sn in H as a subtree.

– The shortest path tree in G \ {ei = (vi , vi+1)} contains the shortest path tree of si+1 in H as a subtree.

• Thus, all the replacement shortest paths trees in G essentially yield the all-pair-shortest-paths in H.

• Using the lower bound of (mn) for the APSP, we arrive at the same lower bound for the problem at hand.

Page 32: On the Difficulty of Some Shortest Paths Problems

Subpaths Deletions

• Given a digraph G, two nodes s and t, the shortest path P from s to t and a set Q = {q1 , q2 ,…, qk} of sub-paths of P. One needs to compute the shortest path from s to t in the graphs G \ qi 1 i k.

• Naïve algorithm.

– Recompute : compute the s - t shortest path in the graphs G \ qi for all 1 i k.

– Time complexity : O (k (m+n log n)).

– We prove a lower bound of (m k) and an upper bound of O(APSP + k.n ) for the problem at hand.

Page 33: On the Difficulty of Some Shortest Paths Problems

Subpaths Deletions (Contd.)

si dj

H

(n-i)W

W = nemaxSi

0 0000 0 0

Dj

s = s0sn dn t=d0

(n-j)W

0 0

Page 34: On the Difficulty of Some Shortest Paths Problems

Subpaths Deletions (Contd.)

• Crucial property : The replacement path from s to t in the graph.

G \ { pi = (si , dj )} follows P till si , enters H at Si , leaves H at Dj , joins P back at dj and follows P till t.

• Thus, the replacement path for each deleted sub-path computes an (si , dj ) distance in H.

• Using the lower bound of the k-pair shortest paths we arrive at a lower bound of (m k) for this problem where the number of sub-paths to be deleted is O(k).

Page 35: On the Difficulty of Some Shortest Paths Problems

Subpaths Deletions : Upper Bound

• The k replacement paths can be computed in O(APSP + k.n).

• Exactly similar to the O(APSP) algorithm for the replacement paths problem : We first sort the sub-paths by their right end points and then continue in the same fashion as earlier.

• Worst case optimal : (m k) and both m and k could be as large as O(n 2), but considerable gap between the upper and lower bounds for smaller values of k and/or m.

Page 36: On the Difficulty of Some Shortest Paths Problems

Concluding Remarks

• These are the first super-linear lower bounds for the problem (s).

• Still a significant gap between the lower bound of (m n) and the trivial upper bound of O(mn + n 2 log n).

• K-shortest paths : Can one solve the problem without using the replacement paths as a subroutine ?

• Faster APSP algorithms can improve the trivial upper bound (these would have to be non path-comparison based).

Page 37: On the Difficulty of Some Shortest Paths Problems

Thank You