improved deterministic algorithms for decremental transitive closure and strongly connected...

69
Improved Deterministic Algorithms for Decremental Reachability and Strongly Connected Components by Jakub Łącki A presentation by Elad Katz Algorithms Seminar Instructed by Prof. Uri Zwick Fall 2012-13 Tel Aviv University

Upload: katzelad1

Post on 20-Mar-2017

49 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Improved Deterministic Algorithms for Decremental Reachability and Strongly Connected Componentsby Jakub ŁąckiA presentation by Elad

KatzAlgorithms Seminar

Instructed by Prof. Uri Zwick

Fall 2012-13Tel Aviv University

Page 2: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Greg’s Cable Map

What happened if Tamares Telecom (brown) went out of business?What about Med Nautilus (dark blue)?

Who got disconnected?

Page 3: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Problem DefinitionLet G=(V, E) be a directed graph, n=|V|, m=|E|.

query(u, v) – check if there is a directed path u → v

delete(u, v) – delete the edge (u, v)

Goal: O(1) query time, minimize deletion timeProblem: Deleting a single edge might affect possible queries!

2( )n

Solution: minimize deletion time of all edges in arbitrary order

Page 4: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Previous ResultsLa Poutre and van Leeuwen DeterministicFrigioni DeterministicDemetrescu and Italiano DeterministicHenzinger and King* Monte CarloBaswana Monte CarloRoditty and Zwick Las Vegas

For maintenance of strongly connected components:Frigioni** DeterministicRoditty and Zwick Las Vegas* query time ** when deleted edges are selected at random

2( )O m2( )O m

3( )O n2( log )O mn n

43 3( log )O mn n

( )O mn

2( )O m( )O mn

( )lognOn

( )O mn

Page 5: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Definitions

Page 6: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

Page 7: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

Page 8: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

A is aninclusio

st rongly connen-maximal st ro

cted congly co

mponnenent

cted (SCC)

set .

Page 9: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

A is aninclusio

st rongly connen-maximal st ro

cted congly co

mponnenent

cted (SCC)

set .( , )u v v uAn edge is an of and anin-edge out - oe ge f d .

Page 10: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

A is aninclusio

st rongly connen-maximal st ro

cted congly co

mponnenent

cted (SCC)

set .( , )u v v uAn edge is an of and anin-edge out - oe ge f d .

A is a gradirected ph with nacyclic graph (DAG o directed cyc) les.

Page 11: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

A is aninclusio

st rongly connen-maximal st ro

cted congly co

mponnenent

cted (SCC)

set .( , )u v v uAn edge is an of and anin-edge out - oe ge f d .

A is a gradirected ph with nacyclic graph (DAG o directed cyc) les.

vA vertex in a DAG is a if it has nosource sink

in-edgesand a if it has no out -edges.

Page 12: Improved deterministic algorithms for decremental transitive closure and strongly connected components

DefinitionsGu v u v if there is a directed path from to .

1 2 1 2, G

S V

s s S s s

st rongly connA non-empty set is if foreve

ecte

dry .

A is aninclusio

st rongly connen-maximal st ro

cted congly co

mponnenent

cted (SCC)

set .( , )u v v uAn edge is an of and anin-edge out - oe ge f d .

A is a gradirected ph with nacyclic graph (DAG o directed cyc) les.

vA vertex in a DAG is a if it has nosource sink

in-edgesand a if it has no out -edges.

( )n O m no isolated vert icAssumpt i es on:

Page 13: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown( , , )

( , )

G w S G wS V

U I U V w I E U

- DAG , source ,a set which contains all other sources.

- unreachable from , incident to .

Input :

Output :

1

2 3

4

5

6

7

8

9

:::

UIQ 6 9

6(6,7)

7

9(9,3) (9,7)7

(7, 2)(7, 8)

8

8

Page 14: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown - Proof

1,...,.

Let be a topological ordering of .Assume by induct ion iff it is unreachable from .If , it is inserted to at some point .If it is inserted at line 6, it is a source

k

j

i

v v Gj i v U w

v U Qw

Proof :

1

( , ) ( )

, therefore it is unreachable from .If it is inserted at line 14, it cannot be , which is a source.By the induct ion hypothesis is unreachable from for all ,hence is unreachable

j j i

i

wv

v w v v E G

v

from .If is unreachable from , it is either a sourceor all it s predecessors are unreachable from .If it is a source, it is not it self and is inserted to at line 6.Otherwise, by the induct ion

i

wv w

ww Q hypothesis all it s predecessors,

unreachable from , are inserted to .Consequent ly all it s in-edges are deleted, and it is inserted to at line 14.

w QQ

The algorithm is correct .Lemma : The algorithm is correct .Lemma :

Page 15: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown –Runtime Analysis

Line 5 requires t ime.Lines 8-9 require t ime, since no vertex is inserted to more than once.Lines 10, 12 require t ime, as no edge is processed more than once.Overall, The algorithm runs in

O S

O U Q

O I

O t ime.S U I

Page 16: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown - Usage

( )There exists a total t ime determinist ic algorithmfor decremental single-source reachability of a .

O mDAG

Lemma:

Page 17: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown - Usage

( )There exists a total t ime determinist ic algorithmfor decremental single-source reachability of a .

O mDAG

Lemma:

( )

( , ) , ,

( , )

We maintain the set of vert ices reachable from the source .The init ial set is obtained using BFS in .After each delet ion of we call FindUnreachable( ) ,and delete returned

sO m

u v E G v s

U I

Proof :

( ) from the graph.

The total size of all outputs of calls t o FindUnreachable is ,so we get the required running t ime.

O m

Page 18: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown - Usage

( )There exists a total t ime determinist ic algorithmfor decremental single-source reachability of a .

O mDAG

Lemma:

( )

( , ) , ,

( , )

We maintain the set of vert ices reachable from the source .The init ial set is obtained using BFS in .After each delet ion of we call FindUnreachable( ) ,and delete returned

sO m

u v E G v s

U I

Proof :

( ) from the graph.

The total size of all outputs of calls t o FindUnreachable is ,so we get the required running t ime.

O m

( )There exists an total t ime determinist ic algorithmfor decremental maintenance of the t ransit ive closure of a .

O mnDAG

Corollary:

Page 19: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachableDown - Usage

( )There exists a total t ime determinist ic algorithmfor decremental single-source reachability of a .

O mDAG

Lemma:

( )

( , ) , ,

( , )

We maintain the set of vert ices reachable from the source .The init ial set is obtained using BFS in .After each delet ion of we call FindUnreachable( ) ,and delete returned

sO m

u v E G v s

U I

Proof :

( ) from the graph.

The total size of all outputs of calls t o FindUnreachable is ,so we get the required running t ime.

O m

( )There exists an total t ime determinist ic algorithmfor decremental maintenance of the t ransit ive closure of a .

O mnDAG

Corollary:

Run the above algorithm for every vertex.Proo f :

Page 20: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachable( , , )

( , )

, ,t

G w S G wS V

U I w U VI E U

G w S

- DAG , sink ,a set which contains all other sinks.

- is unreachable from , incident to .

FindUnreachableDown( )

Input :

Output :

FindUnreachableUp

Implementation:

Page 21: Improved deterministic algorithms for decremental transitive closure and strongly connected components

( , , )

( , )

, ,t

G w S G wS V

U I w U VI E U

G w S

- DAG , sink ,a set which contains all other sinks.

- is unreachable from , incident to .

FindUnreachableDown( )

Input :

Output :

FindUnreachableUp

Implementation:

( , )

( , ) G G

G S G s tS V

U I U V u U s u tI E U

- DAG with dist inguished source and sink ,a set which contains all other sources and sinks.

- , there is no path incident to .

FindUnreaInput :

Output :

chable

, , , ,G s S G t SFindUnreachableDown( ) FindUnreachableUp( )Implementation:

FindUnreachable

Page 22: Improved deterministic algorithms for decremental transitive closure and strongly connected components

FindUnreachable - Examples

out

in

out

in

Page 23: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Decremental Maintenance of SCCs

,

,, ( , )

Let be a directed graph, , .query( ) - check if and are in the same SCCdelete( ) - delete the edge

G V E n V m E

u v u vu v u v

Page 24: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Decremental Maintenance of SCCs

,

,, ( , )

Let be a directed graph, , .query( ) - check if and are in the same SCCdelete( ) - delete the edge

G V E n V m E

u v u vu v u v

We can find init ial SCCs in linear t ime is st rongly connected.G

Assumption:

Page 25: Improved deterministic algorithms for decremental transitive closure and strongly connected components

More Definitions

Page 26: Improved deterministic algorithms for decremental transitive closure and strongly connected components

More Definitions is a directed graph obtained from by cont ract ing

all it s SCCs, preserving mult iple edges but not C

sondense

elf lo)

s.(

opGG

Page 27: Improved deterministic algorithms for decremental transitive closure and strongly connected components

More Definitions is a directed graph obtained from by cont ract ing

all it s SCCs, preserving mult iple edges but not C

sondense

elf lo)

s.(

opGG

, is the graph obtained from by split t ing into vert ices and .

is given all the in-edges, is given all the out -edges. and are the source and sink used

Spl

by Find

it ( )

Unr h

eac

in out

in out

in out

G dd d

d dd d

G d

able.

Page 28: Improved deterministic algorithms for decremental transitive closure and strongly connected components

More Definitions is a directed graph obtained from by cont ract ing

all it s SCCs, preserving mult iple edges but not C

sondense

elf lo)

s.(

opGG

, is the graph obtained from by split t ing into vert ices and .

is given all the in-edges, is given all the out -edges. and are the source and sink used

Spl

by Find

it ( )

Unr h

eac

in out

in out

in out

G dd d

d dd d

G d

able.

:, ,S Cplit ondeAndConde nse(Splinse( )) t ( )G G dd

Page 29: Improved deterministic algorithms for decremental transitive closure and strongly connected components

More Definitions is a directed graph obtained from by cont ract ing

all it s SCCs, preserving mult iple edges but not C

sondense

elf lo)

s.(

opGG

, is the graph obtained from by split t ing into vert ices and .

is given all the in-edges, is given all the out -edges. and are the source and sink used

Spl

by Find

it ( )

Unr h

eac

in out

in out

in out

G dd d

d dd d

G d

able.

:, ,S Cplit ondeAndConde nse(Splinse( )) t ( )G G dd

1

1 2

2, , , is the graph obtained from byreplacing all occurrences of and withMerg )

.e( H d

d Gd d G

d d

Page 30: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Example1

2 3

4

5

6

7

Page 31: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Example1

2 3

4

5

6

7

Split

1out

2 3

4 5

6

7

1in

Split

Page 32: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Example1

2 3

4

5

6

7

Split

1out

2 3

4 5

6

7

1in

Split

Condense

Page 33: Improved deterministic algorithms for decremental transitive closure and strongly connected components

2 3 4

7

5

6

Example1

2 3

4

5

6

7

Split

1out

1in

Split

Condense

Page 34: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Example1

2 3

4

5

6

7

SplitSplit

Condense

Merge

1

5

6

7

2 3 42 3 4

7

5

6

1out

1in

Page 35: Improved deterministic algorithms for decremental transitive closure and strongly connected components

,( , ) ,

Let be a graph and define SplitAndCondense( ) .Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

nts of Merge( ) form seperate SCCs of .U G

Back to FindUnreachable

Page 36: Improved deterministic algorithms for decremental transitive closure and strongly connected components

,( , ) ,

Let be a graph and define SplitAndCondense( ) .Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

nts of Merge( ) form seperate SCCs of .U G

1 2,

If there exists a path , Merge( ) .Fix , then is a st rongly connected set in .Assume by cont radict ion is not maximal, then there arevert ices s.t . there is a path

dGout ind d U U

u U u Gu

v u v u v

Proof :

1 2 1

1

2

.If the path includes , there is a path , correspondingto a path , and , a cont radict ion.If the path does not include , it corresponds to a path

d d

d

G G

G G

G Gin out

G

v v

d d v d

d u d u Ud

u v

, ...

( )

, but is a DAG, a contradict ion.If there is no path , . No cycle of contains ,

thus split t ing does not break any other SCC in ,and Merge( )=Merge( ) are the SCCs

d

d

Gd

Gout in d

d

u G

d d U V G G dd G

U V G

of .G

Back to FindUnreachable

Page 37: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (2) ,

( , ) ,Let be a graph and define SplitAndCondense( ) .

Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.

d

d

U G

G d V G U

U V G d

Page 38: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (2) ,

( , ) ,Let be a graph and define SplitAndCondense( ) .

Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.

d

d

U G

G d V G U

U V G d

( )\ ( )\

( ) \ ( ) \

( ) \

If there exists a path , .From (1) , the SCC containing is a subset of Merge( ) .It is a SCC because for every there is a path

d

d d

Gout in d

d

d

V G U V Gout

d d U V G

d V G U V G U

v V G U

d v

Proof :

, corresponding to a path .If there is no path , .

The SCC containing is , otherwise there is a path through another vertex of the SCC, a cont radic

d

d

U G Gin

Gout in d

Gout in

d d v d

d d U V G

d d d d

t ion.

Page 39: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (3) ,

( , ) ,Let be a graph and define SplitAndCondense( ) .

Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

( ) \

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.(3) The SCCs of are Merge( ) .

d

d

d

U G

G d V G U

U V G d

G V G U U

Page 40: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (3) ,

( , ) ,Let be a graph and define SplitAndCondense( ) .

Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

( ) \

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.(3) The SCCs of are Merge( ) .

d

d

d

U G

G d V G U

U V G d

G V G U U

( ) \ ( ) \

( ) \

( ) \

If , from (1) and (2) the SCCs are given byMerge( ) Merge( ) Merge( ) .

If , is an empty set and from (1)the SCCs are given by Merge( ) Merge( ) .

d

d d

d d

d

U V G

V G U U V G U U

U V G V G U

U V G U U

Proof :

Page 41: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (4)

( , ) ( ) ' '

( , ) ', ,

Let be a st rongly connected graph and defined as above.Delete from and obtaining and .Let be the result computed by FindUnreachable( ) .(1) The SCC of

d

d d d

d

G Gu v E G G G G G

U I G u v

Corollary:

( ) \

\

containing shrinks to Merge( ) .(2) New SCCs, given by Merge( ) , emerge.

dG d V G U d

U d

,( , ) ,

Let be a graph and define SplitAndCondense( ) .Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

( ) \

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.(3) The SCCs of are Merge( ) .

d

d

d

U G

G d V G U

U V G d

G V G U U

Page 42: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (4)

( , ) ( ) ' '

( , ) ', ,

Let be a st rongly connected graph and defined as above.Delete from and obtaining and .Let be the result computed by FindUnreachable( ) .(1) The SCC of

d

d d d

d

G Gu v E G G G G G

U I G u v

Corollary:

( ) \

\

containing shrinks to Merge( ) .(2) New SCCs, given by Merge( ) , emerge.

dG d V G U d

U d

,( , ) ,

Let be a graph and define SplitAndCondense( ) .Let be the result returned by FindUnreachable( ) ,where contains all sources and sinks in except for and .(1) All eleme

d

d

d in out

G G G dU I G SS G d d

Le : mma

( ) \

( )

( ) \

nts of Merge( ) form seperate SCCs of .(2) The SCC of which contains is given by Merge( ) if , and otherwise.(3) The SCCs of are Merge( ) .

d

d

d

U G

G d V G U

U V G d

G V G U U

Direct ly from the lemma.Proof :

Page 43: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (5)

' ( , )

' ( ', ') | ' | | ' |

Let , , and be defined as in the previous corollary.Assuming we have already computed , We can obtain an implicitrepresentat ion of Condense( ) in t ime.

d

d

C C C C

G G G U IG

G V E O V E

Lemma:

Page 44: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (5)

' ( , )

' ( ', ') | ' | | ' |

Let , , and be defined as in the previous corollary.Assuming we have already computed , We can obtain an implicitrepresentat ion of Condense( ) in t ime.

d

d

C C C C

G G G U IG

G V E O V E

Lemma:

'From the corollary, we can compute the vertex set of

Condense( ) using FindUnreachable. It s edges can be obtainedfrom by replacing every edge endpoint which does not belongto with , the vd

GI

U v

Proof :

ertex of Condense( ) containing .G d

Page 45: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (5)

' ( , )

' ( ', ') | ' | | ' |

Let , , and be defined as in the previous corollary.Assuming we have already computed , We can obtain an implicitrepresentat ion of Condense( ) in t ime.

d

d

C C C C

G G G U IG

G V E O V E

Lemma:

'From the corollary, we can compute the vertex set of

Condense( ) using FindUnreachable. It s edges can be obtainedfrom by replacing every edge endpoint which does not belongto with , the vd

GI

U v

Proof :

ertex of Condense( ) containing .G d

dG G When deleting edges from , we can track strong connectivity of !

Page 46: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (5)

' ( , )

' ( ', ') | ' | | ' |

Let , , and be defined as in the previous corollary.Assuming we have already computed , We can obtain an implicitrepresentat ion of Condense( ) in t ime.

d

d

C C C C

G G G U IG

G V E O V E

Lemma:

'From the corollary, we can compute the vertex set of

Condense( ) using FindUnreachable. It s edges can be obtainedfrom by replacing every edge endpoint which does not belongto with , the vd

GI

U v

Proof :

ertex of Condense( ) containing .G d

dG G When deleting edges from , we can track strong connectivity of !

What about other Q: edges?

Page 47: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to FindUnreachable (5)

' ( , )

' ( ', ') | ' | | ' |

Let , , and be defined as in the previous corollary.Assuming we have already computed , We can obtain an implicitrepresentat ion of Condense( ) in t ime.

d

d

C C C C

G G G U IG

G V E O V E

Lemma:

'From the corollary, we can compute the vertex set of

Condense( ) using FindUnreachable. It s edges can be obtainedfrom by replacing every edge endpoint which does not belongto with , the vd

GI

U v

Proof :

ertex of Condense( ) containing .G d

dG G When deleting edges from , we can track strong connectivity of !

What about other Q: edges?, Maintain SCCs of Split ( ) - A: G d Trees!

Page 48: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

Page 49: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

,

,,

Let be a st rongly connected graph. An of is:If , a single node containing .Otherwise, a root containing SplitAndCondense( ) ,and a child for each SCC SplitAndCo

SCC

nde

-t r

nse( )which i

ee G G

G v v

G dv G d

s the SCC-t ree of , except for only one child

for both and .in out

vd d

Page 50: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

,

,,

Let be a st rongly connected graph. An of is:If , a single node containing .Otherwise, a root containing SplitAndCondense( ) ,and a child for each SCC SplitAndCo

SCC

nde

-t r

nse( )which i

ee G G

G v v

G dv G d

s the SCC-t ree of , except for only one child

for both and .in out

vd d

A is a vertex of a SCC-tnode ree.

Page 51: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

,

,,

Let be a st rongly connected graph. An of is:If , a single node containing .Otherwise, a root containing SplitAndCondense( ) ,and a child for each SCC SplitAndCo

SCC

nde

-t r

nse( )which i

ee G G

G v v

G dv G d

s the SCC-t ree of , except for only one child

for both and .in out

vd d

A is a vertex of a SCC-tnode ree.An is a non-linne eaf r node node.

Page 52: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

,

,,

Let be a st rongly connected graph. An of is:If , a single node containing .Otherwise, a root containing SplitAndCondense( ) ,and a child for each SCC SplitAndCo

SCC

nde

-t r

nse( )which i

ee G G

G v v

G dv G d

s the SCC-t ree of , except for only one child

for both and .in out

vd d

A is a vertex of a SCC-tnode ree.An is a non-linne eaf r node node.

( )For any node :

is it s parent node.N

p N

Page 53: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Even More Definitions

,

,,

Let be a st rongly connected graph. An of is:If , a single node containing .Otherwise, a root containing SplitAndCondense( ) ,and a child for each SCC SplitAndCo

SCC

nde

-t r

nse( )which i

ee G G

G v v

G dv G d

s the SCC-t ree of , except for only one child

for both and .in out

vd d

A is a vertex of a SCC-tnode ree.An is a non-linne eaf r node node.

( )For any node :

is it s parent node.N

p N

( ) is the graph in the node.D N

Page 54: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Example1

2 3

4

5

1in 2 3 4 5 1out

2in 2out34 5 1

2 34in 5 4out

4 5

Page 55: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Constructing SCC Trees

( )( )

An SCC-t ree can be const ructed in t ime,where is the depth of the t ree. It requires space.

O mO n m

Lemma:

Page 56: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Constructing SCC Trees

( )( )

An SCC-t ree can be const ructed in t ime,where is the depth of the t ree. It requires space.

O mO n m

Lemma:

( )( )

The t ree can be const ructed in t ime using a linear t imealgorithm for finding SCCs, as each level of the t ree takes t ime.

O mO m

Proof :

( )The t ree has leaves and each inner node has at least two children,therefore the total number of nodes is .There is a biject ion between vert ices in graphs of inner nodesto their children in the

nO nD

( ) t ree, hence the total number of vert ices

in all graphs is . Also, each edge is stored in only one node.Consequent ly we get the required space.

D O n We do not store the SCCs explicitly!

Page 57: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Deleting an Edge 1

2 3

4

5

1in 2 3 4 5 1out

2in 2out3 1

2 34 5

4

5

1in2 3 4 1out

2in 2out3 1

2 34

4

5

5

2in 2out3 1

2 34

4 5

, : [ ] [ ]query( )u v SCC u SCC v

1in 2 3 4 5 1out

2in 2out34 5 1

2 34in 5 4out

4 5

Page 58: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Runtime Analysis( )

(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

Page 59: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Runtime Analysis( )

(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

( )( )

( ) ( )

By the lemma const ruct ing the SCC-t ree takes t imeand uses space.Every edge is lifted up the t ree t imes, a total of lift -ups.

FindUnreachable takes linear t ime with

O mO n m

O O m

Line 1:

Proof :

respect to it s input and output .It s output consists of edges to be lifted up or deleted,and it s input consists of vert ices lifted-up,which gives the required running t ime.

Each subt ree is liftLine 4 : ( )( )

( )( )

ed up t imes. Each vertex and edge are lifted up t imes.Each vertex incident to is lifted up t imes.Each subt ree is lifted up t imes.

OO

e OO

Line 6 :Line 8 : Line 10 :

Page 60: Improved deterministic algorithms for decremental transitive closure and strongly connected components

( )(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

Runtime Analysis (2)

Page 61: Improved deterministic algorithms for decremental transitive closure and strongly connected components

( )(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

Runtime Analysis (2)

( )(1)

( )

There exists an total t ime determinist ic algorithmfor decremental maintenance of SCCs which answers queries in t imeand uses space.

O mnO

O n m

Corollary:

Page 62: Improved deterministic algorithms for decremental transitive closure and strongly connected components

( )(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

Runtime Analysis (2)

( )(1)

( )

There exists an total t ime determinist ic algorithmfor decremental maintenance of SCCs which answers queries in t imeand uses space.

O mnO

O n m

Corollary:

( )Direct ly From the theorem, we have proved .O n Proof :

Page 63: Improved deterministic algorithms for decremental transitive closure and strongly connected components

( )(1) ( )

If the depth of an SCC-t ree is , the algorithm processesany sequence of edge delet ions in total t ime and answerseach query in t ime, using space.

O mO O n m

Theor em:

Runtime Analysis (2)

( )(1)

( )

There exists an total t ime determinist ic algorithmfor decremental maintenance of SCCs which answers queries in t imeand uses space.

O mnO

O n m

Corollary:

( )Direct ly From the theorem, we have proven .O n Proof :

What about the transitive closure?

Page 64: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to the Transitive Closure

( )

(1) ( )

There exists an total t ime determinist ic algorithmfor decremental maintenance of the t ransit ive closure which answersqueries in t ime and uses space.

O mn

O O n m

Theorem:

Page 65: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Back to the Transitive Closure

( )

(1) ( )

There exists an total t ime determinist ic algorithmfor decremental maintenance of the t ransit ive closure which answersqueries in t ime and uses space.

O mn

O O n m

Theorem:

We first build SCC-t rees for each SCC of the graph,then the SCCs are cont racted to create a DAG.When delet ing an edge from the DAG we use the algorithmfrom the first corollary.When delet ing an

Proof :

edge from inside a SCC we use the algorithm from thelast corollary, if the SCC decomposes we use FindUnreachableDownwith the set of vert ices of the decomposed SCC as the second parameter.When checking [ ] [ ] for a path from to we check if or if there is a path from the SCC of t o the SCC of .

u v SCC u SCC vu v

Page 66: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Planar Graphs( ) 8

0 1A planar graph , , has a subset of vert ices whose

removal decomposes it into components of size at most easepe

ch, .The subset can be found in linear t imrator e.

G V G n nn

Theorem*:

* Lipton & Tarjan, 1979

Page 67: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Planar Graphs( ) 8

0 1A planar graph , , has a subset of vert ices whose

removal decomposes it into components of size at most easepe

ch, .The subset can be found in linear t imrator e.

G V G n nn

Theorem*:

1.5

( , )

( )

Let be a directed planar graph and .There exists an algorithm for decremental maintenance of it s SCCswhich runs in total t ime.

G V E V n

O n

Theorem:

* Lipton & Tarjan, 1979

Page 68: Improved deterministic algorithms for decremental transitive closure and strongly connected components

Planar Graphs( ) 8

0 1A planar graph , , has a subset of vert ices whose

removal decomposes it into components of size at most easepe

ch, .The subset can be found in linear t imrator e.

G V G n nn

Theorem*:

1.5

( , )

( )

Let be a directed planar graph and .There exists an algorithm for decremental maintenance of it s SCCswhich runs in total t ime.

G V E V n

O n

Theorem:

2

( )(1) ( ) (1)

( ) 8 ( ) 8 8 ( )

We use the previous algorithm for maintaining SCCs,only choosing vert ices to split from the seperator.The depth of the SCC-t ree is then bounded:nn O n O

n n n n n n

P of ro :

1.5

8... (1)1

( ) ( )Therefore, the algorithm runs in overall t ime.

n O O n

O m O n

* Lipton & Tarjan, 1979 3 6 ( ) In planar graphs .m n O n Note:

Page 69: Improved deterministic algorithms for decremental transitive closure and strongly connected components

The End