410 likes | 539 Views
Improved Decremental Algorithms for. Transitive Closure All-Pairs Shortest Paths in Directed Graphs. Surender Baswana work supported by a fellowship from Infosys Tech. Bangalore Sandeep Sen work supported in part by an IBM UPP award I.I.T. Delhi India.
E N D
Improved Decremental Algorithms for • Transitive Closure • All-Pairs Shortest Paths in Directed Graphs
Surender Baswana work supported by a fellowship from Infosys Tech. Bangalore Sandeep Sen work supported in part by an IBM UPP award I.I.T. Delhi India Ramesh Hariharan I.I.Sc. Bangalore India 34th ACM STOC 2002
Two Fundamental Algorithmic Graph Problems • Transitive Closure • All-Pairs Shortest Paths
Transitive Closure • Process a given directed graph G(V,E) so that any query of the form, “ Is there a path from u to v in the graph?” can be answered efficiently
ExistingStatic Algorithms • Classical Algorithms : O(mn) • Algorithms based on fast matrix multiplications : O(n2.575) (Zwick, FOCS 1998)
Dynamic Maintenance of APSP (Transitive Closure) Given a directed graph G(V,E) followed by an online sequence of updates interspersed with queries Process each query and update efficiently
Aim of Dynamic Algorithms for APSP (Transitive Closure) To Maintain a data-structure that • can answer each query efficiently • can be updated efficiently after each update (in time less than the best static algorithm)
Two Types of Dynamic Algorithms • Fully Dynamic ( both insertion and deletion of edges allowed) • Partially Dynamic Incremental (only insertion) Deletion (only deletion)
Contribution of our Paper Decremental Algorithms for • Transitive Closure • APSP that achieve improved update time while keeping optimal query time
Main Idea A new data-structure that • stores transitive closure imformation implicitly • is more suitable for maintaining reachability for long paths
Main Idea Contd. Suitably combine two data-structures • S: suitable for reachability corresponding to short paths. • L : suitable for reachability corresponding to long paths.
Basic Data-structure Used Theorem : A BFS tree of depth d, rooted at a vertex can be maintained under deletion of edges that • takes O(1) query time • requires O(d) amortized update time per edge deletion.
Implicit Maintenance of Transitive Closure v u Out_tree In_tree
Transitive closure corresponding to paths of length d passing through set of witnesses W
Transitive closure corresponding to paths of length d passing through set of witnesses W
Transitive closure corresponding to paths of length d passing through set of witnesses W v M u
Transitive closure corresponding to paths of length d passing through set of witnesses W w v M u
Handling Edge Deletion w W’ u v v M w u
Handling Edge Deletion contd. w W’ u v v M w u W’ u v
Handling Edge Deletion contd. w W’ u v v M w u W’ u v
Handling Edge Deletion contd. • For each w, update in_tree(w) and out_tree(w) • For each pair (u,v) for which w has ceased to remain witness, search for new witness. • Update M[u,v] appropriately
Handling Edge Deletion contd. • Invariant maintained : M[u,v] points to the first vertex in the witness list W that is a witness of reachability from u to v
Total update time • For each pair (u,v), the witness list is scanned exactly once. O(n |W|) • Total update time for maintaining in_trees and out_trees O(md|W|) 2
Maintaining all-pairs reachability corresponding to paths of length <d passing through W Theorem : All-pairs reachability corresponding to paths of length <d passing through vertices of set W can be maintained under deletion of edges in amortized time : O((n2/m + d)W) per edge deletion
Random sampling to pick the witness vertices Theorem : Given a path puv of length l from u to v, if we sample cn/l log2 n vertices (for any c>0), then with probability 1-1/nc , at least one of the vertices will be picked from the path puv
Maintaining all-pairs reachability corresponding to paths of length [d/2,d] • Form a set Wdof n/d log n vertices uniformly randomly. • Build and maintain in_trees and out_trees on vertices of set Wd. Update time : O((n3/(dm) + n)log n)
Maintaining all-pairs reachability corresponding to paths of length [d,n] • For each interval [2id,2i+1d], build and maintain in_trees and out_trees on a collection of n/(2id) log n vertices. • Maintain the reachability matrix M Total Update time : O((n3/(dm) + n)log2 n)
Explicit maintenance of transitive closure for path of length [1,d] Update time : O(nd) Implicit maintenance of transitive closure for paths of length [d,n] Update time : O((n3/(dm)+n)log2n) Comparing the two data-structures
Explicit maintenance of transitive closure for path of length [1,d] Update time : O(nd) Suitable for short paths Implicit maintenance of transitive closure for paths of length [d,n] Update time : O((n3/(dm)+n)log2n) Suitable for long paths Comparing the two data-structures
Improved Decremental Algorithm for maintaining all-pairs 2-approximate paths
w v u
Invariant maintained : M[u,v] points to the first vertex in the witness list W that is a witness of reachability from u to v