Dynamic Graph � Algorithms Giuseppe F. Italiano University of Rome Tor Vergata giuseppe.italiano@uniroma2.it http://people.uniroma2.it/giuseppe.italiano/
Outline Dynamic Graph Problems – Quick Intro Topic 1. (Undirected Graphs) Dynamic Connectivity & MST Topic 2. (Undirected/Directed Graphs) Dynamic Shortest Paths Topic 3. (Non-dynamic?) 2-Connectivity in Directed Graphs
Frederickson (Topology trees & clustering) Query O(1) Update O(m 1/2 ) 3
Frederickson Algorithm is quite complicated • Maintain graphs of degree ≤ 3 • Compute and maintain clusters: m/z clusters with z vertices/edges, clusters can be split and merged. This gives O(z + (m/z) 2 ) = O(m 2/3 ) • Take clusters of clusters (multilevel decomposition) • Describe multilevel decomposition via a tree (topology tree) • Define a 2D version of the topology tree • Show how insertions/deletions affect multilevel decomposition and 2D topology tree… Total time per update is O( z + m/z ) = O(m 1/2 ) Will show my simpler version (unpublished) 4
Simpler Frederickson Tree edges solid Non-tree edges dashed 5
Simpler Frederickson Fix an Euler tour 6
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour Adjacency list of vertex 1 7
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour Adjacency list of vertex 6 8
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour Adjacency list of vertex 1 9
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour delete(2,4) Adjacency list of vertex 1 10
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour Adjacency list of vertex 6 11
Simpler Frederickson Fix an Euler tour For each vertex: Sort adjacency list (non-tree edges) by Euler tour delete(2,4) Adjacency list of vertex 6 12
Simpler Frederickson Each vertex v maintains its “view” of the Euler tour (non-tree edges adjacent to v sorted according to Euler tour) When a tree edge gets deleted from (inserted into) the graph: • Euler tour subject to constant # cut / link operations • Adjacency list of vertex v subject to constant # split / merge operations (corresponding to cut / link operations) This gives O(log n) work per vertex After a tree edge gets deleted, the best replacement edge incident to v can be found in time O(log n) Do this for all vertices. Total time is O(n log n) per update 13
Simpler Frederickson Total time is O(n log n) per update Space? Trivial: Keep the full Euler tour at each vertex. Need O(n) space per vertex. Total space is O(n 2 ) 14
EXERCISE 1 Can you improve the space? Say, O(nlog n) time per update and O(m) space 15
Better bounds? “Local” (i.e., per vertex) views have lot of similarities To improve time per update need to combine “local” views into a more “global” view Rather than maintaining n independent Euler tours, maintain something like a global (2D) Euler tour… 16
Simpler Frederickson (2D) 17
Simpler Frederickson (2D) 18
Simpler Frederickson (2D) 19
Recap To maintain dynamic MST Maintain points in a 2D space under split / concatenate operations along coordinates, and orthogonal range queries Each operation can be implemented in O(m 1/2 ) in the worst case with cross tree, which is a (2D) cross product of two balanced trees (ET trees in our case) [Grossi & I. 1999] If you can do better than cross trees, then you can improve Frederickson’s bound… 20
Frederickson (Topology trees & clustering) Query O(1) Update O(m 1/2 ) 21
Eppstein et al. (Sparsification) Query O(1) Update O(n 1/2 ) 22
Sparsification Arbitrarily partition edges: m/n clusters with ≤ n edges each
Sparsification Compute spanning tree (sparse certificate) for each cluster
Sparsification Compute spanning tree (sparse certificate) for each cluster
Sparsification Form union of sparse certificates
Sparsification Form union of sparse certificates
Sparsification Compute again sparse certificate
Sparsification Compute again sparse certificate
EXERCISE 2 30
Sparsification Tree Parent contains union of sparse certificates of children log 2 m/n m/n Each sparsification tree node contains: • graph of size O(n); • certificate of union of graphs at leaf nodes
Sparsification Update
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Update (involves only one child)
Sparsification Propagate change up log 2 m/n Update time = (log m/n )*(cost for m < 2n ) With some extra care, the log can be chopped: update time = (cost for m < 2n )
Certificates Property you need for certificates Given property P , a strong certificate for P in G = (V,E) is a graph C such that: (i) V(C) = V(G) and (ii) For any H, G ∪ H has property P iff C ∪ H has P
Sparsification Provided that one can find sparse certificates with the right property, by using sparsification: Static algorithm with running time f(m,n) yields dynamic algorithm with update time f(n) Dynamic algorithm with update time f(m,n) yields dynamic algorithm with update time f(n)
Holm et al. (Dynamic decomposition) Query O(log n) Update O(log 2 n) 48
How do we find out whether there is a “replacement” edge for the forest or it really got disconnected ? For dynamic MSF it is not enough to find a repacement edge, we need to find the best replacement edge 49
To find a replacement, need to traverse one of the trees, which can be quite expensive. Randomization [Henzinger, King]: sample non-tree edges in smaller tree If sampling fails, push “sparse cut” to upper level Can we do this deterministically? 50
Look in the smaller tree: ‘ tree edge ‘ no replacement - replacement Wish to gain something (in amortized sense) by accumulating information as we do that 51
Each edge has a level 52
1 Each edge has a level 1 1 1 Increase the 1 1 level of the edges in the 1 smaller tree… 53
1 Each edge has 1 a level 1 1 1 1 Increase the 1 1 level of the edges in the 1 smaller tree… … and of any edge discovered not to be a “replacement” 54
1 Each edge has 1 a level 1 1 1 1 Increase the 1 1 level of the edges in the 1 smaller tree… … and of any edge discovered not to be a “replacement” until you find a “replacement” 55
1 1 1 1 1 1 1 1 1 56
1 1 1 1 1 Intuition: 1 Next time you 1 1 have to look again for a 1 replacement… 57
1 1 1 1 1 Intuition: 1 Next time you 1 1 have to look 1 again for a 1 replacement… … no need to look at non-tree edges with label 1! 58
1 1 1 1 1 Intuition: 1 Next time you 1 1 have to look 1 again for a 1 replacement… … no need to look at non-tree edges with label 1! 59
1 1 1 1 1 1 1 1 1 1 60
Keep on doing 1 that upon edge 1 deletions 1 1 1 1 1 1 1 1 61
Keep on doing 1 that upon edge 1 deletions 1 1 1 1 1 1 1 62
Keep on doing 2 that upon edge 1 deletions 2 1 1 Again, 1 increase the 1 level of the 1 1 edges in the smaller tree… 63
Keep on doing 2 that upon edge 2 deletions 2 1 1 Again, 1 increase the 1 level of the 1 1 edges in the smaller tree… … and of any edge discovered not to be a “replacement” 64
Keep on doing 2 that upon edge 2 deletions 2 1 1 Again, 1 increase the 1 level of the 1 1 edges in the smaller tree… … and of any edge discovered not to be a “replacement” until you find a “replacement” 65
Keep on doing 2 that upon edge 2 deletions 2 1 1 Again, 1 increase the 1 level of the 1 1 edges in the smaller tree… … and of any edge discovered not to be a “replacement” until you find a “replacement” 66
Terminology G is the dynamic graph. F is a spanning forest of G. An edge is either a tree edge or a non-tree edge. Each edge has a level ℓ . G ℓ is subgraph of G induced by edges of level ≥ ℓ . G max ⊆ … ⊆ G ℓ ⊆ … ⊆ G 2 ⊆ G 1 ⊆ G 0 = G F ℓ is subforest of F induced by edges of level ≥ ℓ . F max ⊆ … ⊆ F ℓ ⊆ … ⊆ F 2 ⊆ F 1 ⊆ F 0 = F 67
Recommend
More recommend