51
Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research supported in parts by a PhD fellowship from Infosys Technologies Ltd. Bangalore

Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Embed Size (px)

Citation preview

Page 1: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Improved Randomized Algorithms for Path Problems in Graphs

PhD Thesis

Surender Baswana

Department of Computer Science & Engineering,

I.I.T. Delhi

Research supported in parts by a PhD fellowship from Infosys Technologies Ltd. Bangalore

Page 2: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Organization of the talk

Practical importance of algorithms/theoretical computer science.

Description of the problems addressed during PhD.

Application of the problems, and new results.

What I gained from my PhD.

My experiences, esp. invaluable support from Infosys.

Page 3: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Theoretical Computer Science Is it feasible to solve a problem ?

Is a problem practically tractable ?

Traveling Salesman Problem : Given a set of cities, find the tour of least distance.

No algorithm that performs better than 2n operations.

Designing algorithm for solving a problem that requires

minimum time (# of operations) and optimal storage.

Page 4: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Sorting Algorithms

Selection sort, Bubble sort, Insertion sort

n2 comparisons in worst case Merge Sort : n log2 n comparisons in worst case

Quick sort : (A randomized algorithm)

n2 comparisons in worst case

n log2 n comparisons on an average

Quick sort performs better than all the sorting algorithms

Practically. Probability that quick sort deviates from its expected running

time asymptotically is less than 2–cn .

Page 5: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Path Problems in Graphs

Process a given graph G(V,E) so that we can retrieve a path with certain characteristics between each pair of vertices.

n = number of vertices in a given graph.

m = number of edges in a given graph.

Page 6: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Directed Graph

Page 7: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Directed Weighted Graph

10 13

7

1825 17

27

15

21

916

27

11 7

1910

10

50

Page 8: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All Pairs Reachability (Transitive Closure)

Given a pair of vertices x,y in V,

Is there a path from x to y ?

Page 9: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All-Pairs Reachability (Transitive Closure)

x

y

Page 10: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All-Pairs Reachability (Transitive Closure)

x

y

Processing time : mn

Page 11: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All-Pairs Shortest Paths

Given a pair of vertices x,y in V,

report the shortest path (or distance) from x to y.

Page 12: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All-Pairs Shortest Paths

10 13

7

1825 17

59

7

21

916

27

11 7

1910

10

50

xy

a

b

c d

e

Page 13: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

All-Pairs Shortest Paths

10 13

7

1825 17

59

7

21

916

27

11 7

1910

10

50

xy

a

b

c d

e

x-b-e-y

x-b-c-d-e-y

x-a-y 67

58

78

Processing time : mn log n

Page 14: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Network Design Problem

Page 15: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Network Design Problem

Page 16: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Network Design Problem

1210

30

65

40

69

59

100

120

56

34

59

80150

24

6979

150

Page 17: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Objective

To minimize the number of links to be

selected without increasing the route time

between any pair of nodes too much.

Page 18: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

An Example

1210

30

65

51

69

53

100

120

56

34

59

80150

24

6979

150

Page 19: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

An Example

1210

30

65

51

69

53

100

120

56

34

59

80150

6979

150

X

Y

A

B

C

F

Page 20: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

k-Spanner of a Weighted Graph

Given a graph G(V,E) , a sub-graph GS(V,E’) is said to be k-spanner if for each u,v in V,

ds(u,v) ≤ k . d(u,v)

Page 21: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Application of Sparse Spanner

Network design, especially for making succinct routing tables.

Computational biology : in the reconstruction of phylogeny trees from matrices whose entries represent distances among contemporary living species.

Design of network synchronizers, and computation of all-pairs approximate shortest paths.

Page 22: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Computing a Sparse k-Spanner

Objective : a Sparse spanner with minimum stretch

A trade off between stretch and the size A k-spanner in the worst case may need at-least n1+1/k

edges.

Example : There can’t be a 3-spanner with less than n3/2 edges for every graph.

Page 23: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Algorithms for Computing (2k-1)-Spanner

Persons Reference Stretch Running time

Das, et al. Journal : DCG, 93

(2k-1) mn 1+1/k

Thorup and Zwick

Conf. :ACM STOC, 2001

(2k-1) mn1/k

Page 24: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Algorithms for computing (2k-1)-spanner

Persons Reference Stretch Running time

Das, et al. Journal : DCG, 93

(2k-1) mn 1+1/k

Thorup and Zwick

Conf. :ACM STOC, 2001

(2k-1) mn1/k

Baswana and

SenConf. :ICALP, 2003

(2k-1) m

Page 25: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Approximate Distance Oracles

Usually all-pairs shortest distances are stored in an nхn matrix.

Is it possible to require less than n2 storage and still answer a distance query in constant time?

Yes, but at the expense of introducing approximation.

3-Approximate Distance oracle of size n3/2

Page 26: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Advantage of Approximate Distance Oracles

For answering shortest path queries in external-memory

Page 27: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Advantage of Approximate Distance Oracles

For answering shortest path queries in external-memory

RAM Hard-DiskCPU

Fast Slow

Page 28: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Approximate Distance Oracles

Thorup and Zwick [STOC’01] gave first algorithm for computing approximate distance oracle with

Size : n1+1/k Stretch : 2k-1 Preporcessing time for building a (2k-1)-approximate

distance oracle :

mn1/k

Worst case preprocessing time for

3-Approximate Distance Oracle would be n2.5.

Question : Can 3-approximate distance oracle be computed in n2 time ?

Page 29: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Algorithms for ComputingAll-Pairs Approximate Distance Oracle

Person Reference Stretch Size Preprocessing time

Dijkstra All text Books on Algorithms

1 n2 mn

Page 30: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Algorithms for ComputingAll-Pairs Approximate Distance Oracle

Person Reference Stretch Size Preprocessing time

Dijkstra All text Books on Algorithms

1 n2 mn

Thorup and Zwick

Conf.ACM-STOC

2001

2k-1 n1+1/k mn1/k

Page 31: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Algorithms for ComputingAll-Pairs Approximate Distance Oracle

Person Reference Stretch Size Preprocessing time

Dijkstra All text Books on Algorithms

1 n2 mn

Thorup and Zwick

Conf.ACM-STOC

2001

2k-1 n1+1/k mn1/k

Baswana

and SenConf.ACM-SIAM SODA 2004

2k-1 n1+1/k Min

(mn1/k ,n2)

Page 32: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Path Problems in Dynamic Graphs

Page 33: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Example of a Dynamic Graph

x

y

b

c d

e

f

g

Page 34: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Example of a Dynamic Graph

x

y

b

c d

e

f

g

Page 35: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Example of a Dynamic Graph

x

y

b

c d

e

f

g

Page 36: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Example of a Dynamic Graph

x

y

b

c d

e

f

g

Page 37: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Example of a Dynamic Graph

x

y

b

c d

e

f

g

Page 38: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Dynamic Graph Problem

Given a graph G=(V,E) Online sequence of queries interspersed with updates.

Objective :

1. To Answer each query efficiently in online fashion.

2. Perform updates in the solution efficiently.

Naive Solution :

After every update, re-compute the solution right from scratch.

Page 39: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Dynamic Graph Algorithm

Maintain some data-structure that can answer each query efficiently.

The time required to maintain the data-structure after each update is much less than the static graph algorithm.

For each static graph algorithm/problem, there is a dynamic graph algorithm/problem as its counterpart.

Page 40: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Applications of Dynamic Graph Algorithms

Communication networks.

Relational databases augmented with transitive closure.

Incremental parser generator.

Page 41: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Maintaining All-Pairs Reachability under Deletion of edges

Static algorithm requires mn time. A combination of algorithms of Demetrescu et al. [IEEE

FOCS 2000] and Leeuwen et al. [TCS 1991] requires

n3/2 update time per edge deletion

Baswana S., Hariharan R., Sen S. design an algorithm that requires

n4/3 update time per edge deletion

Page 42: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Maintaining All-Pairs Shortest Paths under Deletion of Edges

Static algorithm requires mn time. An algorithm of Demetrescu and Italiano [IEEE FOCS

2001] requires

n3/m update time per edge deletion For sparse graphs, the update time of above algorithm : n2

Baswana S., Hariharan R., Sen S. design an algorithm that requires

n3/2 update time per edge deletion for all graphs Proceedings of 34th Annual ACM Symposium on Theory of Computing,

Montreal, Quebec, Canada, May 19-21, 2002.

Page 43: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Maintaining All-Pairs Approximate Shortest Paths under Deletion of Edges Improved static algorithms for shortest paths at the

expense of approximation.

Can we achieve better update time for maintaining approximate shortest paths?

Baswana S., Hariharan R., Sen S. design an algorithm that requires

Close to n update time per edge deletion

Proceedings of 14th Annual ACM-SIAM Symposium on Discrete Algorithms, Baltimore, Maryland, USA, January 12-14, 2003.

Page 44: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Maintaining All-Pairs Approximate Shortest Paths under Deletion of Edges

Stretch factor Update time

3 n10/9

5 n14/13

7 n28/27

Page 45: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Linear time Algorithm for computing a 3-spanner

Objective : Select no more than n3/2 edges and ensure a stretch of 3 at-most.

Vertices of degree more than n½ are difficult to handle.

Solution :

* Clustering of vertices

* Random sampling to form clusters

Page 46: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

A Linear time Algorithm for computing

a 3-spanner. Sample n½ vertices uniformly randomly

If a vertex v is not adjacent to any sample vertex, select all its edges for spanner.

Otherwise, add all the edges having weight less than that of the edge between the vertex and its nearest sampled vertex nv.

The vertex v belongs to the cluster centered at nv

Page 47: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

The Linear time Algorithm contd.

v

Page 48: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

The Linear time Algorithm contd.

v

Page 49: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Analyzing the correctness of algorithm

Consider an edge u-v not present in the spanner.

Both u and v must belong to clusters.

Case1 : both u and v belong to same cluster

Case2 : both u and v belong to different clusters

u v

w

v u w

u’

Page 50: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Gains from my PhD

Fulfilled the desire of working in theoretical computer science.

A beginning of research. The joy of exploring a research area of my

interest independently. Analytical skills that may be applied in

diverse areas.

Page 51: Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research

Invaluable support from Infosys

Every research need fulfilled. Used the generous contingency grant for

buying a few of my dream books. Used the support for traveling to

conferences abroad. PhD won’t have been completed so

peacefully without Infosys Fellowship.