Strict Fibonacci Heaps Gerth Stølting Brodal Aarhus University George Lagogiannis Robert Endre Tarjan Agricultural University of Athens Princeton University & HP 44th Annual ACM Symposium on Theory of Computing, New Yorker Hotel, New York, May 22, 2012
The Problem — Priority Queues Insert(value, key) FindMin DeleteMin / Delete(&value) Meld(Q1,Q2) DecreaseKey(&value, Δ) (C,11) (M,36) (B,14) (X,86) 12 (A,27) (K,54) A 15 (D,24) (Z,29) (W,6) DecreaseKey = Delete+Insert Borůvka = problem to electrify the Czech Republic Jarnik = Prim(1957)s algorithm β(m,n) is for all pratical valures 3-4. Applications 15 1 8 12 9 16 25 11 3 13 22 5 14 10 6 2 17 4 19 t s Insert/DeleteMin Shortest Path Dijkstra (1956) Minimum Spanning Tree Borůvka (1926) Jarník (1930) (n node, m edges) (m+n)∙log n m+n∙log n m∙β(m,n) Fredman, Tarjan 1984 + DecreaseKey 15 1 8 12 9 16 25 11 3 13 22 5 14 10 6 2 17 4 19 MST only Fredman, Tarjan 1984 + DecreaseKey
Amortized complexity (Tarjan 1983) History Binomial queues Run-relaxed heaps Strict Fibonacci heaps Binary heaps Fibonacci heaps Williams 1964 Vuillemin 1978 Fredman Tarjan 1984 Driscoll et al. 1988 Brodal 1995 Brodal 1996 Lagogianis STOC 2012 Insert log n 1 FindMin Delete n Meld - DecreaseKey Run-relaxed heaps : SSSP MST real time applications, parallel algorithms worst-case guarantees important, single source shortest paths Since 90s people working on the problem incl Katajainen, Elm-Asry, Tarjan, Kaplan... trying to simplify solution Arrays Complicated Pointer Based Amortized complexity (Tarjan 1983)
Global partial control Technical History Min 8 7 4 6 86 17 11 16 27 27 12 6 13 24 42 54 36 86 Local control = consequence of wanting Meld to be O(1) Binary heaps Fibonacci heaps Binary heaps 1964 Binomial queues 1978 Fibonacci heaps 1984 Run-relaxed heaps 1988 Brodal 1995 1996 Strict Fibonacci heaps 2012 Heap-order Rigid structure Forest Linking Subtrees cut Cascades Amortized DecreaseKey Global control Redundant counters Local control Local redundant counters Heap order violations Global partial control Pigenhole principle single tree
Ideas Meld smallest tree red + link 4 12 16 8 5 42 12 6 21 11 7 11 Invariants white nodes share one color record white children left of red root is red color white 15 14 23 15 14 23 color red Meld smallest tree red + link white root 2 Intuition Only maintain structure for white nodes Red non-root nodes never increase degree Delete: O(1) red nodes white 1 Definitions white node rank = #white children DecreaseKey: cut + mark parent (if white) Invariants i’th rightmost white child of a white node: rank + #marks ≥ i - 1 #marks + #white roots = O(log n) Theorem max rank O(log n)
Priority Queue Operations 2 FindMin = return root Insert = make single red node + Meld Delete = DecreaseKey to - + DeleteMin Meld = color smaller tree red + link + O(1) transformations DecreaseKey = cut + link with root + O(1) transformations DeleteMin = cut root + find new root + O(log n) link + O(log n) transformations root degree +1 root degree +1; white root (+1); marks (+1) root degree +O(log n); white root +O(log n) Invariant R = α·log (3/2 · #white nodes + #red nodes) + β degree unmarked white nodes ≤ R degree red and marked white nodes ≤ R – 1
One node mark reduction Two node mark reduction Transformations Root degree reduction Converts two red nodes to white; reduces the root degree by two; creates one new white root White root reduction Two white roots of rank r is replaced by one rank r+1; increases root degree by one x root z 0/0 1/0 y y x z below root r/0 One node mark reduction White node with ≥ 2 marks becomes a white root (unmarked); increases the root degree by one Two node mark reduction Two nodes of equal rank r with 1 mark become unmarked; one parent one more mark below root y x ≥ 2 marks z y x r/1 r / m = rang / #marks
Representation ref-count active ... Q-prev x left-child rank left right parent flag color record Q-next singles color-record root size non-linkable-child Q-head heap record 3 1 4 2 fix-list rank-list left right transformable nodes with marks white roots node marked pointers from unmarked white nodes with rank 1 and with white parent inc dec rank maximum
Thank You Williams Vuillemin Fredman Tarjan Driscoll et al. Binomial queues Binary heaps Fibonacci heaps Run-relaxed heaps Strict Fibonacci heaps Williams 1964 Vuillemin 1978 Fredman Tarjan 1984 Driscoll et al. 1988 Brodal 1995 Brodal 1996 Lagogianis STOC 2012 Insert log n 1 FindMin Delete n Meld - DecreaseKey Arrays Pointer Based Amortized Thank You