Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Graph Algorithms

Similar presentations


Presentation on theme: "Dynamic Graph Algorithms"— Presentation transcript:

1 Dynamic Graph Algorithms
II Surender Baswana Visiting Professor till 31st May 2020 Heinz Nixdorf Institute & Department of Computer Science (Algorithms and Complexity Group)

2 Fully dynamic connectivity
Update time Query time Reference O( 𝒎 ) O(𝟏) Frederickson, SICOMP 83 O( 𝒏 ) O(𝟏) Eppstein et al. J. ACM 91 expected amortized randomized O( log 𝟑 𝒏) O(log 𝒏) Henzinger and King, J.ACM 99 Prerequisites ? Elementary knowledge of probability

3 Deterministic Algorithm
Input Output The output as well as the running time are functions only of the input. Algorithm

4 Deterministic Algorithm
Randomized Random bits Input Output The output or the running time are functions of the input and random bits chosen . Algorithm

5 Organization of the Talk
𝟏. Random sampling 𝟐. Experiencing the difficulty of the problem 𝟑. A simple but inefficient algorithm 𝟒. Designing the efficient algorithm

6 Part I Random Sampling A gentle introduction

7 Elementary Probability
Tossing a coin 𝟏 𝟐 𝒌 𝐏[ No HEAD appears in 𝒌 tosses] = ?

8 Problem: Given an array A[1…𝑛] storing 0/1s. Report any index storing 𝟏. Theorem: For every deterministic algorithm, there exists an input for which 𝛀(𝑛) entries will be scanned to find the first 𝟏. At least ½ of the entries in A are 𝟏. A 𝟎 𝟎 𝟏 𝟎 𝟎

9 Random Sampling Problem: Given an array A[1…𝑛] storing 0/1s. Report any index storing 𝟏. At least ½ of the entries in A are 𝟏. 1 𝑘 A 𝟎 𝟏 Randomized Algorithm count  𝟎; Repeat count  count +𝟏; 𝒊 a random number from [𝟏..𝒏]; Until ((A[𝒊] ≠𝟏) and (count < 𝒄 log 𝒏)) 𝒌 𝟏 𝟐 𝒄log 𝒏 𝟏 𝒏 𝒄 Probability of failure :

10 Experiencing the difficulty of the problem
Part II Experiencing the difficulty of the problem

11 Fully dynamic connectivity

12 Fully dynamic connectivity
Update time Query time Reference O( 𝒎 ) O(𝟏) Frederickson, SICOMP 83 O( 𝒏 ) O(𝟏) Eppstein et al. J. ACM 91 expected amortized randomized O( log 𝟑 𝒏) O(log 𝒏) Henzinger and King, J.ACM 99 1 2 1 2 3 2 log 𝒏 O( 𝒎 log 𝟐 𝒏) O( 𝒌 𝒎 log 𝟐 𝒏) 𝒌 levels

13 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time

14 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
The 2-level algorithm 2 1

15 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
Idea: Maintain a spanning forest

16 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
Decremental What is the real challenge ?

17 A simple but inefficient algorithm
Part III A simple but inefficient algorithm

18 A simple decremental algorithm
Question: Can we find a replacement edge in 𝑶 (| 𝝁(𝑻) |) time ? Operations Time Enumerating all non-tree edges incident on a tree 𝑻 O(𝝁(𝑻)log 𝒏) Checking if two vertices belong to the same tree O(log 𝒏) 𝝁(𝑻) : non tree edges 𝑻

19 A simple decremental algorithm
Question: Can we find a replacement edge in 𝑶 (| 𝝁(𝑻) |) time ? Euler Tour tree 𝝁(𝑻) : non tree edges 𝑻 Homework: Picking a non-tree edge randomly uniformly in O(log 𝒏) time ?

20 The efficient algorithm
Part IV The efficient algorithm

21 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
Decremental A combination of two simple tools A simple 𝑶 (| 𝝁(𝑻) |) time algorithm Random sampling Exercise

22 1 |cut( 𝑻 𝟏 , 𝑻 𝟐 )| |𝝁( 𝑻 𝟏 )| ≥ 𝟏 𝒌 < 𝟏 𝑘 sparse dense
Data structure for 𝑻 𝟏 ≥ 𝟏 𝒌 < 𝟏 𝑘 sparse dense 1 Pick non tree edge incident on 𝑻 𝟏 𝑘 log 𝑛 uniformly randomly 𝑻 𝟏 𝑻 𝟐 𝑻 cut( 𝑻 𝟏 , 𝑻 𝟐 )

23 Trivial algorithm at Level 𝟐 What if the cut is sparse ?
|𝝁( 𝑻 𝟏 )| < 𝟏 𝒌 sparse Trivial algorithm at Level 𝟐 What if the cut is sparse ? Level 𝟐 Level 𝟏 𝑻 𝟏 𝑻 𝟐 Random sampling at level 𝟏

24 Handling the deletion of a tree edge
2-Level approach A partition of 𝑬 into two levels : ( 𝑬 𝟏 , 𝑬 𝟐 ) In the beginning, 𝑭 𝟏 : spanning forest of 𝑬 𝟏 𝑭 𝟐 : spanning forest of 𝑬, 𝑬 𝟏 =𝑬 and 𝑬 𝟐 = Ø 𝑭 𝟏 ⊆ 𝑭 𝟐

25 Algorithm for Deletion of tree edge (𝒖,𝒗)
yes (𝒖,𝒗) ϵ 𝑭 𝟐 \ 𝑭 𝟏 ? scan 𝝁 𝟐 Level 𝟐 No 𝑻 𝟏 : smaller tree Sample(𝝁( 𝑻 𝟏 )) 𝒆 yes 𝒆 ∈ cut( 𝑻 𝟏 , 𝑻 𝟐 ) ? Join 𝑻 𝟏 and 𝑻 𝟐 at Level 1 No yes Level 𝟏 counter++ <𝒄𝒌 log 𝒏 ? No Compute cut( 𝑻 𝟏 , 𝑻 𝟐 ) No Probability ≤𝒏 −𝒄 Is cut( 𝑻 𝟏 , 𝑻 𝟐 ) sparse ? yes Move cut( 𝑻 𝟏 , 𝑻 𝟐 ) to Level 2 Add an edge from cut( 𝑻 𝟏 , 𝑻 𝟐 ) to 𝑭 𝟐

26 Analysis ≤ |𝝁( 𝑻 𝟏 )| 𝒌 charge 𝒅𝒆𝒈⁡(𝒗) 𝒌 edges to each 𝒗 ∈𝑻 𝟏
Upon splitting 𝑻 into 𝑻 𝟏 and 𝑻 𝟐 , how many edges are passed to level 2 ? ≤ |𝝁( 𝑻 𝟏 )| 𝒌 charge 𝒅𝒆𝒈⁡(𝒗) 𝒌 edges to each 𝒗 ∈𝑻 𝟏 | 𝝁 𝟐 | = O( 𝑚 𝑘 log 𝑛) Level 𝟐 Level 𝟏 𝒗 𝑻 𝟏 𝑻 𝟐

27 Analysis Theorem: Decrement connectivity can be maintained in expected amortized 𝐎( 𝒎 log 2 𝒏 ) time per edge deletion. Cases Time taken (𝒖,𝒗) ϵ 𝑭 𝟐 \ 𝑭 𝟏 O( 𝒎 𝒌 log 2 𝒏) (𝒖,𝒗) ϵ 𝑭 𝟏 O(𝒌 log 2 𝒏) + O(𝝁( 𝑇 1 ) log 𝒏) ×𝒏 −𝒄

28 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
Add every newly inserted edge to level 𝟐. Periodically rebuild the data structure after every 𝒎 insertions. Expected amortized time per update : O( 𝒎 log 𝒏) Theorem: Fully dynamic connectivity can be maintained in expected amortized 𝐎( 𝒎 log 𝒏 ) time per update.

29 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
The 2-level algorithm Trivial algorithm at Level 𝟐 𝟐 𝟏 Random sampling at level 𝟏 Reduce the sampling rate

30 Fully dynamic connectivity with O( 𝒎 lo g 𝟐 𝒏) update time
The 3-level algorithm Trivial algorithm at Level 𝟑 𝟑 Trivial algorithm at Level 𝟐 Random sampling at level 𝟐 𝟐 𝟏 Random sampling at level 𝟏 Homework 𝒌 levels O( 𝒌 𝒎 log 𝟐 𝒏)

31 Minimum spanning tree Single source shortest paths tree
An open problem Minimum spanning tree Single source shortest paths tree A tree that minimizes the “average” stretch for all pairs.

32 An open problem 𝑑𝑖𝑠 𝑡 𝑇 (𝑢,𝑣) = distance between 𝑢 and 𝑣 in tree 𝑇. 𝑆𝑡𝑟𝑒𝑡𝑐 ℎ 𝑇 (𝑢,𝑣) = A𝑣𝑒𝑟𝑎𝑔𝑒𝑆𝑡𝑟𝑒𝑡𝑐ℎ(𝑇) = There exists an O(𝑚 polylog 𝑛) time algorithm to compute a spanning tree with average stretch (polylog 𝑛). Can we maintain such a tree efficiently dynamically ? 𝑑𝑖𝑠 𝑡 𝑇 𝑢,𝑣 𝑑𝑖𝑠 𝑡 𝐺 𝑢,𝑣 1 |𝐸| 𝑢,𝑣 ∈𝐸 𝑆𝑡𝑟𝑒𝑡𝑐 ℎ 𝑇 (𝑢,𝑣)


Download ppt "Dynamic Graph Algorithms"

Similar presentations


Ads by Google