- 64 Views
- Uploaded on
- Presentation posted in: General

Dynamic Graph Algorithms - I

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Dynamic Graph Algorithms - I

SurenderBaswana

Department of CSE, IIT Kanpur.

- Prerequisite:a course on data structure and algorithms
- Survey of the results: (not the main objective of the talk)
- Main contents:
-- A novel data structure

-- A fully dynamic algorithm for a fundamental graph problem AIM:

To give an exposure to the beautiful area of dynamic algorithms

animation

Algorithm

G=(V,E)

Solution

No assumption about the updates.

- For problems involving queries (connectivity, distance,…):
initial graph G=(V,E) followed by a sequence

q,u,u,q,u,u,u,q,u,q,q,u, …

q: query

u: insertion/deletion of edge

Each query has to be answered in an online manner.

- For problems that aim to maintain some structure (matching, spanner, min-cut,…)
initial graph G=(V,E) followed by a sequence

u,u,u,u,u,u,u, …

The structure has to be maintained in an online manner.

Aim: Maintain a data structure which can

- answer each query efficiently (or maintain the structure), and
- process each update efficiently (much faster than the static algo)
Types of dynamic graph algorithms:

- Incremental (only insertion of edges)
- Decremental(only deletion of edges)
- Fully dynamic (both insertion and deletion of edges)

u

Static solution:

v

b

d

b

d

c

c

d

b

a

a

b

a

b

d

c

c

c

b

a

c

- Incremental Algorithm: O(log* n) update time
(Disjoint Set Union Algorithm[Tarjan 1975])

- Decremental Algorithm:
- O(n) update time [Even and Shiloach, 1981]
- O(log n)update time [Thorup 1997]

Fully Dynamic Algorithms:

- O()update time [Frederickson, 1982]
- O() update time [Eppstein, Galil, Italiano, Nissenzweig 1991]
- O(polylog n) expected update time, O(log n)query time
[King and Henzinger1995]

4. O(polylog n)update time,O(log n)query time

[Holm, Litchenberg, Thorup 1998]

- Dynamic graph algorithms for some important problems
- Data structure for dynamic trees
- Fully dynamic connectivity with polylog n update time
- Open problems

Examples of fully dynamic algorithms

- Connectivity
- 2-edge connectivity
- Bi-connectivity
- Bipartiteness
- Min. spanning tree
O(polylog n) update time [Holm, Litchenberg, Thorup 1998]

- Min-cut
- Best static algorithm: O(m polylog n) (Randomized) [Karger, 1996]
- Fully dynamic algorithm: O() update time [Thorup, 2001]

- Graph spanner
Definition:

A subgraph which is sparse and yet preserves all-pairs distances approximately.

- Best static algorithm: O(m) [Halperin, Zwick, 1996]
- Fully dynamic algorithm: O(polylog n) update time
[Baswana, Khurana, and Sarkar, 2008]

Maintaining BFS tree under deletion of edges :

O(n)time per edge deletion [Even & Shiloach, 1981]

- Unbeaten till date.
- Used in many dynamic algorithms for directed graphs.

Not as good bounds as undirected graphs

Transitive Closure

- Incremental algorithm: O(n)update time [Italiano, 1986]
- Decremental algorithm: O(n)update time
- Randomized[Roditty and Zwick, 2002]
- Deterministic [Lacki, 2011 ]

- Fully Dynamic algorithm: O() update time [Roditty, 2003]
All-pairs Shortest paths

- Fully dynamic algorithms:
- Amortized O() update time [Demetrescu and Italiano, 2003]
- Worst case O()update time [Thorup, 2005]

Data structure for dynamic trees

- Stacks
- Queues
- Binary heap
- Binary search tree
...

- Fibinaacci heap

- Too elementary
- Limited applications

- Too complex
- Hardly any application !

Maintain n records r(1),…,r(n) under the following operations

- Add(i,j,x) : Add x to each record from r(i),…,r(j).
- All-swap(i,j) :r(i)↔r(j), r(i+1) ↔ r(j-1), r(i+2) ↔ r(j-2).
- Report(i) : report record r(i).
- Report-min(i,j) : report the smallest record from r(i),…,r(j).

Each operation in O(log n) worst case time.

: Additional information

j

g

a

b

f

e

c

d

u

u

v

w

Aim : Maintain a forest of trees on n vertices under the following operation.

- Link(u,v) : Add an edge between u and v
- Cut(u,v) : Delete an edge between u and v
- Update() : Update information associated with nodes/edges
- Query() :
- Topological
- information associated with a tree, or a path

- ST Tree [Sleator&Tarjan, 1983]
Operations and queries on edges of paths

- ET tree [Henzinger and King, 1995]
Operations and queries on nodes of a tree

- Top tree [Alstrup et al., TALG 2005]
(generalization of Topology Tree [Frederickson, 1982])

Topological properties (diameter, center)

j

g

a

b

17

2

3

5

Operations :

Link(u,v)

Cut(u,v)

Update-weight-node(v,a):

weight(v) a

Add-weight-tree(v,x):

add x to weight of each node of tree of v

ReportMin(u):

report min weight in the entire tree containing u

41

f

e

7

32

c

d

-3

12

u

44

15

67

u

v

w

ReportMin(v) = 12

j

g

a

b

17

2

3

5

Operations :

Link(u,v)

Cut(u,v)

Update-weight-node(v,a):

weight(v) a

Add-weight-tree(v,x):

add x to weight of each node of tree of v

ReportMin(u):

report min weight in the entire tree containing u

41

f

e

7

32

c

d

-3

12

u

44

15

67

u

v

w

ReportMin(v) changes …

j

g

a

b

17

2

3

5

Operations :

Link(u,v)

Cut(u,v)

Update-weight-node(v,a):

weight(v) a

Add-weight-tree(v,x):

add x to weight of each node of tree of v

ReportMin(u):

report min weight in the entire tree containing u

41

f

e

7

32

c

d

-3

12

u

44

1

67

u

v

w

h

d

g

c

a

b

e

f

How to transform a tree into a one dimensional data structure ?

f

c

h

c

g

a

a

b-c-d-c-b-a-

e-f-e-g-e-h-e

-a-b

e

b

e

b

b

d

e

e

h

d

g

c

a

b

e

: minimum value of all nodes in the subtree.

f

f

a

b

c

h

c

d

c

g

a

a

e

f

g

e

b

e

b

b

d

e

e

b-c-d-c-b-a-

e-f-e-g-e-h-e

-a-b

h

h

d

g

c

a

b

e

f

b-c-d-c-b-a-

e-f-e-g-e-h-e

-a-b

h

d

g

c

a

b

e

f

b-c-d-c-b-a-

e-f-e-g-e-h-e

-a-b

h

d

g

T2

T1

c

a

b

e

f

b-c-d-c-b-a

a-b

T1

e-f-e-g-e-h-e

h

d

g

T2

T1

c

a

b

e

f

b-c-d-c-b-a

a-b

T1

e-f-e-g-e-h-e

T1

h

d

g

T2

T1

c

a

b

e

f

b-c-d-c-b-a

a-b

T1

e-f-e-g-e-h-e

T1

h

d

g

T2

T1

c

a

b

e

f

b-c-d-c-b-a

a-b

T1

e-f-e-g-e-h-e

T1

h

d

g

T2

T1

c

a

b

e

Split(T,(e,a))

Merge(T1,T2,(u,v))

Change-origin(T,x) :

change the origin of Euler tour to vertex x.

f

T1

T2

b-c-d-c-b-a-b

e-f-e-g-e-h-e

T1

T2

Fully dynamic algorithm for connectivity

Maintain ET tree for each tree in the spanning forest

Maintain ET tree for each tree in the spanning forest

A Hierarchical algorithm

2 log n

3

2

1

A 2-level algorithm

2

1

Key tools in addition to ET tree data structure:

- Trivial algorithm (for handling deletion of a tree edge) :
Let (u,v) be a tree edge in the spanning forest.

Let its deletion creates trees T1 and T2.

Let µbe the number of non-tree edges incident on T2.

Replacement edge can be found in time O(µ log n) time.

- Random sampling

- Exercise: If none of 2k log n balls is blue, then with probability , the fraction of blue balls is less than 1/k.

Uniform random sampling

with replacement

How to augment ET-tree to sample an edge ?

Few samplings needed if the fraction of blue edges is large

What if fraction of blue edges is small ?

T2

T2

T1

T

- A partition of E into two levels : (E1, E2)
In the beginning, E1 =E and E1 = Ø

- F1: spanning forest of E1
- F2: spanning forest of E, F1is subset of F2

Level 2

Level 1

Level 2

Level 1

Trivial algorithm at level 2

Level 2

Level 1

Random sampling at level 1

probability

O(µ1(T2))time

O(µ2) time

If (eϵF2\ F1) scan non-tree edges at level 2 to find replacement edge.

Else Let T be the tree to which e belongs;

(T1,T2) Split(T,e);

Repeat k log n times

{ (u,v) Sample-edge(T2);

If (u,v) is a cut-edge

{ add (u,v) to F1;

Merge(T1,T2, (u,v)); return;

}

}

Scan all non-tree edges incident on T2;

If less than 1/k fraction are cut-edges

move all edges of cut(T1,T2) to Level 2 and add one of them to F2.

Else add an edge of cut(T1,T2) to F1

O(k logn) time

Upon splitting T into T1 and T2, how many edges are passed to level 2 ?

≤

charge to each ϵ T2

Level 2

Level 1

T1

T2

- A vertex v is processed only O(log n) times.
Whenever v is processed

The processing cost of v is O(deg(v))

The number of edges that move to level 2 is less than

Hence µ2 , the number of edges at level 2 is O(log n)

- Processing cost per update :
log n +k + O(m)

= O()

- Add every newly inserted edge to level 2.
- Periodically rebuild the data structure after every () insertions.
Expected amortized time per update : O()

- A partition of E into 2log nlevels : (E1, E2,…)
In the beginning, E1 =E and Ei= Øfor all i>1

- F1 : spanning forest of E1
- Fi: spanning forest of
- Fi-1is subset of Fi for all i>1

A Hierarchical algorithm

2 log n

2

2

c

1

Open Problems

- Amortized cost versus worst case bounds
- Specific problems : Min-cut, s-t min cut, max-flow, …
- Specific graph family : Planar graphs
- Better lower bounds ?