Rubao Ji Advisor: Dr. Robert W. Robinson Committee: Dr. E. Rodney Canfield Dr. Daniel M. Everett Dynamic connectivity algorithms for Feynman diagrams
Introduction Algorithm design and time complexity analysis Data structure and implementation Experimental results and discussions Outline of Thesis
G lineV line A Feynman diagram with order of n can be viewed as a matching on 2n nodes (edges in the matching are undirected and called V-lines) along with a permutation of the 2n nodes (represented by directed edges called G- lines) [ Introduction ] Feynman Diagram
G lineV line A Feynman diagram with order of n can be viewed as a matching on 2n nodes (edges in the matching are undirected and called V-lines) along with a permutation of the 2n nodes (represented by directed edges called G- lines) [ Introduction ] Feynman Diagram
G lineV line A Feynman diagram with order of n can be viewed as a matching on 2n nodes (edges in the matching are undirected and called V-lines) along with a permutation of the 2n nodes (represented by directed edges called G- lines) [ Introduction ] Feynman Diagram
aa´a´ bb´b´ Switch(a,b) aa´a´ bb´b´ Switch(2,4) Switch(4,0) Connected Not Connected [ Introduction ] Switching and Connectivity
aa’ bb’ Switch(a,b) aa’ bb’ Switch(2,4) [ Introduction ] Switching and Connectivity
Dynamic graph problem: Answer queries on graphs that are undergoing a sequence of updates (e.g. insertions and deletions of edges and vertices) [ Introduction ] Fully-dynamic Semi-dynamic (incremental, decremental) Dynamic algorithm: Update the solution of a problem more efficiently after dynamic changes rather than having to re- compute it from scratch each time (static). Dynamic vs. Static
[ Introduction ] Running time of one single operation averaged over a sufficiently long sequence of operations Amortized Time any sequence long enough worst case bond Expected Time sequence has some distribution or is random probabilistic worst case Amortized & Expected
[ Introduction ] A Brief History Deterministic algorithms Frederickson, O(m 1/2 ) O(1) Epstein et al., O(n 1/2 ) O(1) Henzinger&King, O(n 1/3 log n) O(log n/loglog n) Holm et al., O(log 2 n) O(log n/loglog n) Randomized algorithms Henzinger&King, O(log 3 n) O(log n/loglog n) Henzinger&Thorup, O(log 2 n) O(log n/loglog n) Thorup, O(log n(loglog n) 3 ) O(log n/logloglog n) UpdateQuery UpdateQuery
1.Number of G-cycles 2.Update time 3.Query time [ Algorithm design and time complexity analysis ] O (log n) O (log ? n) Features that matter
[ Algorithm design and time complexity analysis ] For a randomly generated Feynman diagram of order n, the expected number of G-cycles is O(log n). C l : G-cycle containing vertex v has length l Pr [C 1 ]= 1/2n Pr [C 2 ]=(2n-1)/2n * 1/(2n-1) = 1/2n Pr [C 3 ]=(2n-1)/2n * (2n-2)/(2n-1)*1/(2n-2) =1/2n : v Prove: Pr [C l ]= 1/2n Lemma 2.1
[ Algorithm design and time complexity analysis ] X i : the size of the G-cycle containing node i S: total number of G-cycles Lemma 2.1 (cont’d)
[ Algorithm design and time complexity analysis ] 1.Splay Tree (Self-Adjusting BST) 2.Treap (BST + Heap) Update G-cycle: In-order traversal V-line: Implicit numbering
[ Algorithm design and time complexity analysis ] Update 1.Splay Tree (Self-Adjusting BST) 2.Treap (BST + Heap) G-cycle: In-order traversal V-line: Implicit numbering
[ Algorithm design and time complexity analysis ] Lemma 2.2 Each splay operation has an amortized time of O(log n) over (n) operations such that the tree size is always O(n). ( From Sleator&Tarjan,1985 ) Lemma 2.3 Each treap operation has an expected time of O(log n) averaged over all permutations of the nodes for the priority attribute. ( From Seidel & Aragon, 1996 ) Update
[ Algorithm design and time complexity analysis ] x x Splay(x) t1 x Join(t1,t2) t2 x t1t2 x Split(x,t) x t1t2 Update: Splay Tree
[ Algorithm design and time complexity analysis ] x delete(x) t1 x Join(t1,t2) t2 t1t2 x Split(x,t) x t1 t2 Insert(x) x b a Rotate left Rotate right b a y Update: Treap delete(x) x y
SCQ (Simplified Connectivity Query) ACQ (Advanced Connectivity Query) IDQ (Integrated DFS Connectivity Query) [ Algorithm design and time complexity analysis ] Query
Straightforward approach Simple DFS or pre-order traversal Linear [ Algorithm design and time complexity analysis ] Query: SCQ
More complicated than SCQ Start from smallest component O(log 2 n) [ Algorithm design and time complexity analysis ] Query: ACQ
[ Algorithm design and time complexity analysis ] ACQ algorithm has an expected cost of O(log 2 n) time to query the connectivity of Feynman diagram. S i The probability that at least i attempts will be needed to find another component. D 1 > 1/2, D 2 > 1/2 + 1/4 … D n > 1/2 + 1/4 + ··· +1/2 (n-1) D i The probability that, in examing vertices in the smallest component, a V -edge joining it to another component will be found in i attempts. S i > 1 - D i Ex[Steps] < 1 + 1/2 + 1/4 + …= 2 O(log n) expected component, O(log n) expected joins, after each join, take O(log n) expected time to find the smallest component. Lemma 2.4
Integrated with update process Maintain a G-cycle graph O(log n) [ Algorithm design and time complexity analysis ] Query: IDQ
[ Algorithm design and time complexity analysis ] a b a b Case 1 Case 2 Switch(a,b) IDQ (cont’d)
[ Algorithm design and time complexity analysis ] a b a b Case 1 Case 2 Switch(a,b) IDQ (cont’d)
[ Algorithm design and time complexity analysis ] a b a b Case 1 Case 2 Switch(a,b) IDQ (cont’d)
DFS (Linear in number of G- cycles) Chance of disconnected O(1/n) If connected, O(1) to update the edge [ Algorithm design and time complexity analysis ] IDQ (cont’d) IDQ algorithm has an expected cost of O(log n) time to query the connectivity of Feynman diagram.
[ Algorithm design and time complexity analysis ] Using a splay forest data structure for Feynman diagram update combined with ACQ for connectivity queries gives an amortized expected time per operation of O(log 2 n). Using a treap forest data structure for Feynman diagram update combined with ACQ for connectivity queries gives an expected time per operation of O(log 2 n). Lemma 2.5
[ Algorithm design and time complexity analysis ] Using a splay forest data structure for Feynman diagram update combined with IDQ for connectivity queries gives an amortized expected time per operation of O(log n). Using treap a forest data structure for Feynman diagram update combined with IDQ for connectivity queries gives an expected time per operation of O(log n). Lemma 2.6
[ Data structures and implementations ] ASF (Array-based Splay Forest) ilc[i]rc[i] ##0#2###0#2# ##5#13##5# p[i]p[i] ~2 4 ~ s[i]s[i] Update -ASF
T1T2 a a´a´ b b´b´ a´a´ b´b´ b´b´ Splay(a)Splay(b) Switch a´a´ ab ab [ Data structures and implementations ] Splay(w) w b a´a´ w b´b´ a w b a´a´ Join ASF: Switch(a,b) { a T1, b T2} a a´a´ b b´b´ Switch (a,b) a b´b´ b a´a´
a a´a´ b b´b´ Splay(a) bb’a’ Splay(b) a’b’ a b a Reattach b aa’bb’ Splay(a) bb’a’ Splay(b) b’ a b a Reattach b a’ T T [ Data structures and implementations ] ASF: Switch(a,b) {a,b T} a b´b´ b a´a´ Switch (a,b) a a´a´ b b´b´ a’
[ Data structures and implementations ] ATF (Array-based Treap Forest) ilc[i]rc[i] ##0#2###0#2# ##5#13##5# p[i]p[i] ~2 4 ~ s[i]s[i] prio[i] Update -ATF
T1 T2 aa’ bb’ Split(a) Split(b) Switch [ Data structures and implementations ] a’b’ ww ab w a Delete(w) a’ w b ab’ Join x ab’ba’ Delete (x) ab’ba’ Delete(w) ba’ ATF: Switch(a,b) { a T1, b T2}
aa’bb’ Split(a) bb’a’ Split(b) a’b’ w w w Reattach aa’bb’ Split(a) bb’a’ Split(b) b’ w w Reattach w a’ a a b b a b a b’a b Delete(w) T T ab’ ba’ ATF: Switch(a,b) {a,b T} [ Data structures and implementations ]
nodedownnext Type A node nodep1link Type B node p2adj_next visited [ Data structures and implementations ] IDQ: Adjacency list
[ Data structures and implementations ] IDQ: Switch(a,b) { a T1, b T2}
[ Data structures and implementations ] IDQ: Switch(a,b) {a,b T}
[ Experimental results and discussion ] n: ,000 5000 switches ACQ random Exp 1: ASF vs. ATF
[ Experimental results and discussion ] Exp 2: Update vs. Query
[ Experimental results and discussion ] Exp 3: Frequency of Dis-connection
[ Experimental results and discussion ] Exp 4: Time per Switching
[ Experimental results and discussion ] Exp 5: IDQ/ACQ/SCQ
[ Experimental results and discussion ] Splay tree vs. Treap IDQ vs. ACQ vs. SCQ Further study Discussion
Thanks ! Animation downloaded from:
2 0 0 Insert(2) 2 0 Rotate(2) 2 0 Insert(5) 5 Insert(3) Insert(4) Rotate(4) Insert(1) 2 1 iW[i]W[i]P[i]P[i] [ Data structures and implementations ] ATF: Insert