Marking and Cascading Cuts
The Mark Bit
Each node in a Fibonacci heap carries a boolean marked flag. By definition:
A node is marked if it has lost exactly one child since it became a child of its current parent.
Nodes in the root list are never marked (they have no parent, so the concept is meaningless for them). When a node is first cut and moved to the root list, its marked flag is reset to false.
When Does Marking Occur?
When decrease-key causes a node x to violate the min-heap property (new key < parent’s key):
xis cut from its parent and moved to the root list.- If
x’s parentpis not in the root list, we markp. - If
pwas already marked, we cutpas well — this is the cascading cut.
The rule: a node can lose at most one child and remain in place. Losing a second child forces the node itself to be cut.
Cascading Cut Algorithm
decrease-key(fh, ptr_k, nk):
ptr_k.key = nk
if ptr_k.parent != NIL and ptr_k.key < ptr_k.parent.key:
do:
if !ptr_k.parent.marked:
CHOP-OUT(fh, ptr_k)
break
else:
CHOP-OUT(fh, ptr_k)
ptr_k = ptr_k.parent
while ptr_k.parent != NIL
if fh.min_ptr.key > nk:
fh.min_ptr = ptr_k_orig
CHOP-OUT performs:
- Update parent’s child pointer (if this was the only/designated child)
- Decrement parent’s degree
- If parent has a parent (i.e. is not a root), mark it
- Remove the node from its sibling list
- Set node’s parent = NIL, marked = false, left = right = itself
- Splice into root list
The loop propagates upward: as long as the parent was already marked, it gets cut too, and we continue to its parent.
Why Cascading Cuts? The Grandchild Rule
The cascading cut rule guarantees a crucial structural invariant, sometimes called the grandchild rule:
Consider a node with degree . Order its children by the time they became children of (earliest first). Then for all , the number of grandchildren of via child satisfies:
Reasoning: When acquired child , both and had degree (since already had children). After the link, could lose at most one child (the second loss would trigger a cascading cut, separating from ). So ‘s degree is at least .
This gives the name “Fibonacci heap” because this recurrence leads to Fibonacci numbers.
The Fibonacci Number Connection
Let be the minimum number of nodes in a subtree whose root has degree . From the grandchild rule:
With base cases , . By induction, where is the -th Fibonacci number (). Since with , we get .
Worked Example: Cascading Cut Chain
Consider a min-heap tree: root (key 3, marked false) has children (key 5, marked false), (key 8, marked false). has child (key 10, marked false). has child (key 12).
3(R)
/ \
5(A) 8(B)
/
10(C)
/
12(D)
Step 1: Call decrease-key on D, setting key to 1. Since (C’s key), cut D. D goes to root list. C becomes marked. C was unmarked, so stop.
Roots: [D:1] + 3(R)-5(A)-10(C✓)-8(B)
Step 2: Call decrease-key on C, setting key to 2. Since (A’s key), cut C. C goes to root list, unmarked. A was unmarked, becomes marked. Stop.
Roots: [D:1, C:2] + 3(R)-5(A✓)-8(B)
Step 3: Call decrease-key on A, setting key to 0. Since (R’s key), cut A. A goes to root list, unmarked. R is a root (parent NIL), so R is not marked. Stop.
Roots: [D:1, C:2, A:0] + 3(R)-8(B)
Step 4: Alternative scenario where cascading triggers. Suppose after step 1, we call decrease-key on C (key 3) while A was already marked. Cut C. C goes to root list. A is already marked, so A is also cut! A goes to root list. Now check A’s parent R. R was not marked, so mark R and stop. Two nodes cut for the price of one decrease-key.
Summary
| Concept | Rule |
|---|---|
| Mark bit | Set when a node loses its first child |
| Cascading cut | Triggered when a marked node loses a second child |
| Root nodes | Never marked |
| Cut node | Becomes unmarked on entering root list |
| Grandchild rule | ’s degree when ordered by attachment time |
| Structural guarantee | , implying |
| Name origin | Minimum subtree sizes grow like Fibonacci numbers |