Skip to content
Part IA Lent Term

Fibonacci Heaps: Degree Bound and Analysis

The Degree Bound Problem

For extract-min to be O(logn)O(\log n) amortised, we need the consolidation array size (and thus the maximum degree D(n)D(n)) to be O(logn)O(\log n). This section proves:

Theorem: In a Fibonacci heap with nn nodes, the maximum degree of any node satisfies D(n)logϕnD(n) \le \lfloor \log_\phi n \rfloor where ϕ=(1+5)/21.618\phi = (1+\sqrt{5})/2 \approx 1.618 is the golden ratio.

Fibonacci Numbers

Define Fibonacci numbers with F0=0F_0 = 0, F1=1F_1 = 1:

Fk=Fk1+Fk2for k2F_k = F_{k-1} + F_{k-2} \quad \text{for } k \ge 2

Sequence: 0,1,1,2,3,5,8,13,21,34,55,0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, \ldots

These satisfy two useful identities:

  1. Summation: Fk+2=1+i=0kFiF_{k+2} = 1 + \sum_{i=0}^{k} F_i
  2. Golden ratio bound: Fk+2ϕkF_{k+2} \ge \phi^k for all k0k \ge 0 (proved by induction: ϕ2=ϕ+1\phi^2 = \phi + 1)

Lemma 1: The Grandchild Ordering

Let xx be any node in a Fibonacci heap with degree kk. Order its children c1,c2,,ckc_1, c_2, \ldots, c_k by the time they were linked as children of xx (earliest first). Then:

ci.degreei2for i=1,,kc_i.\text{degree} \ge i - 2 \quad \text{for } i = 1, \ldots, k

Proof:

  • When cic_i was linked to xx, both xx and cic_i had degree at least i1i-1 (since xx already had i1i-1 children).
  • After linking, cic_i could lose at most one child via decrease-key. If it lost a second child, the cascading cut rule would have cut cic_i from xx, and cic_i would no longer be a child of xx.
  • Therefore ci.degree(i1)1=i2c_i.\text{degree} \ge (i-1) - 1 = i-2.

For i=1i=1: when c1c_1 was linked, xx had degree 0, so c1c_1 had degree 0. c1c_1 could have lost at most one child, so c1.degree0c_1.\text{degree} \ge 0, consistent with i2=1i-2 = -1 (and degree is always 0\ge 0).

Lemma 2: Subtree Size Lower Bound

Define sks_k as the minimum number of nodes in any subtree rooted at a node of degree kk in a Fibonacci heap. Then:

skFk+2s_k \ge F_{k+2}

Proof by induction:

Base cases:

  • k=0k = 0: s01=F2s_0 \ge 1 = F_2 (a single root with 0 children)
  • k=1k = 1: s12=F3s_1 \ge 2 = F_3 (root + one child, which is a degree-0 node)

Inductive step (k2k \ge 2): Consider a node zz with degree kk and minimal subtree size sks_k. Order its children by attachment time: c1,c2,,ckc_1, c_2, \ldots, c_k.

By Lemma 1, ci.degreei2c_i.\text{degree} \ge i-2. Since sks_k is monotonic (more children cannot give fewer descendants), the subtree rooted at cic_i has at least smax(0,i2)s_{\max(0, i-2)} nodes.

sk1 (for z itself)+i=1ksmax(0,i2)s_k \ge 1 \text{ (for } z \text{ itself)} + \sum_{i=1}^k s_{\max(0, i-2)}

For i=1i=1: c1c_1 could be degree 0 (initially, or lost its sole child), so at least s0s_0 nodes. For i=2i=2: c2.degree0c_2.\text{degree} \ge 0, at least s0s_0 nodes. For i3i \ge 3: ci.degreei2c_i.\text{degree} \ge i-2, at least si2s_{i-2} nodes.

sk1+s0+s0+i=3ksi2=2+i=0k2sis_k \ge 1 + s_0 + s_0 + \sum_{i=3}^k s_{i-2} = 2 + \sum_{i=0}^{k-2} s_i

By the induction hypothesis siFi+2s_i \ge F_{i+2} for all i<ki < k:

sk2+i=0k2Fi+2=2+i=0k2Fi+2s_k \ge 2 + \sum_{i=0}^{k-2} F_{i+2} = 2 + \sum_{i=0}^{k-2} F_{i+2}

Re-index with j=i+2j = i+2: j=2kFj=j=0kFjF0F1=j=0kFj1\sum_{j=2}^k F_j = \sum_{j=0}^k F_j - F_0 - F_1 = \sum_{j=0}^k F_j - 1.

So sk2+(j=0kFj1)=1+j=0kFj=Fk+2s_k \ge 2 + (\sum_{j=0}^k F_j - 1) = 1 + \sum_{j=0}^k F_j = F_{k+2} (using the summation identity).

Proof of the Main Theorem

For any node xx in a Fibonacci heap with k=x.degreek = x.\text{degree}:

nsize(x)skFk+2ϕkn \ge \text{size}(x) \ge s_k \ge F_{k+2} \ge \phi^k

where nn is the total number of nodes in the entire heap. Taking logarithms base ϕ\phi:

klogϕnk \le \log_\phi n

Since kk is an integer, klogϕnk \le \lfloor \log_\phi n \rfloor. This holds for every node, so

D(n)logϕn=O(logn)D(n) \le \lfloor \log_\phi n \rfloor = O(\log n)

Concrete Worked Example

For n=100n = 100 nodes: logϕ100ln100ln1.6184.6050.4819.57\log_\phi 100 \approx \frac{\ln 100}{\ln 1.618} \approx \frac{4.605}{0.481} \approx 9.57. So D(100)9D(100) \le 9.

For n=106n = 10^6: logϕ10628.7\log_\phi 10^6 \approx 28.7. So D(106)28D(10^6) \le 28.

The consolidation array for extract-min needs only logϕn+1\lfloor \log_\phi n \rfloor + 1 entries — very small even for large heaps.

Consequences

  1. Consolidation array size: D(n)+1=O(logn)D(n)+1 = O(\log n) — only O(logn)O(\log n) entries needed.
  2. Children promoted during extract-min: at most D(n)D(n) children of the old minimum need to be moved to the root list.
  3. Extract-min amortised cost: The cancellation O(r+D(n))+(D(n)+1r)=O(D(n))=O(logn)O(r + D(n)) + (D(n)+1 - r) = O(D(n)) = O(\log n) depends critically on this degree bound.

The entire efficiency of Fibonacci heaps hinges on this structural guarantee provided by the marking and cascading cut regime.

Summary

StatementFormula
Lemma 1 (grandchild)ci.degreei2c_i.\text{degree} \ge i-2
Lemma 2 (subtree size)skFk+2s_k \ge F_{k+2}
Fibonacci boundFk+2ϕkF_{k+2} \ge \phi^k
Degree boundklogϕnk \le \lfloor \log_\phi n \rfloor
Maximum degreeD(n)=O(logn)D(n) = O(\log n)
Consolidation array sizeD(n)+1=O(logn)D(n) + 1 = O(\log n)
Extract-min amortisedΘ(logn)\Theta(\log n)