Transformations

Sometimes, the 5 invariants will get violated in heap operations, and we can perform below transformations to restore the properties

Link

Link node x and y

Active Root Reduction

Performed on two active roots x and y with equal rank r

Result

Effects on Invariants

I1: No violations. The only change in active node is y -- the (r+1)-th rightmost child of x, this is OK since y has rank r and loss 0

I2: Trivially, no violation happens to I2 as no changes on the total loss

I3: This transformation can be used when I3 is violated since it decreases the number of active root by 1. By Lemma 4, we are guaranteed to find two active roots x and y with the same rank to perform this transformation

I4: I4 could be violated as the root degree can increase by 1, but together with Root Degree Reductions(See below and Summary), we can fix the structure in constant time

I5: No violations. The degree of x increases by 1, but we detach z to keep it the same. And, if there is no z to detach, then all children of x is active, and from Lemma 2, we know x has at most degree R

Root Degree Reduction

Performed on the three rightmost passive linkable children x, y, z of the root

Result

Effects on Invariants

I1: No violations as y becomes the 1st rightmost child of x, and y has rank + loss of 0

I2: Trivially, no violation to I2 as no changes to the total loss

I3: It could break I3 as the Active Roots increase by 1, but together with Active Root Reduction, we are still safe

I4: This transformation can be used when I4 is violated since it can decrease the root degree by 2. By Lemma 5, we are guaranteed to find three rightmost passive linkable children x, y, z of the root to perform this transformation

I5: No violations. Both x and y get a new child. But they change from being a passive node to an active node with loss 0, so they are allowed to have one more child.

Note: Because Active Root Reduction increases the root degree by 1 and Root Degree Reduction increases the Active Roots number by 1, they are often performed together to ensure no violations to all 5 invariants (also see Summary)

One Node Loss Reduction

Performed on an active node x with loss 2

Result

Effects on Invariants

I1: No violations. For y's active children on x's right side, they are not affected. For the children on the left side, their constraints are weakened, i.e. goes from at least i - 1 to at least i - 2

I2: This transformation can be used when I2 is violated since it can decrease the loss. By Lemma 3, if the loss constraint is violated by 1, together with Two Node Loss Reduction(described below), we can bring down the total loss to within the constraint

I3 and I4: It could violate I3 and I4 as the Active Roots and Root degree increase by 1, but as explained above, we can perform Active Root Reductions and Root Degree Reductions together to bring them down if needed

I5: Notice this has no effects on I5 as no non-root nodes get new children

Note: Because of I2, I3 and I4, Loss reduction, Active Root Reductions and Root Degree Reductions are always performed together when necessary(also see Summary)

Two Node Loss Reduction

Performed on two active nodes x, y with equal rank r and loss == 1

Result

Effects on Invariants

I1: No violations. The only change in active node is y becomes the (r+1)-th rightmost child of x, this is OK since y has rank r and loss 0

I2: It decreases the loss by at least 1. By Lemma 3, and pair this with One Node Loss Reduction, we can keep I2.

I3 and I4: Unlike One Node Loss Reduction, active roots and root degree are not increased, so no violations

I5: The degree of x is increased by 1, however, it changes from being an active node with positive loss to an active node with loss 0, so it's allowed to have one more child.

Summary

Note, from the above analysis and the summary in the chart, we can conclude no transformations can break I1, I2 and I5. And if we perform Active Root Reduction with Root Degree Reduction (with One or Two Nodes Loss Reduction), no transformations can violate I1 to I5.

In the following sections, we will see Active Root Reductions are always paired with Root Degree Reductions to ensure no violations happen to the 5 invariants. And after a loss reduction is performed, Active Root Reductions and Root Degree Reductions are performed to ensure the invariants aren't broken.


The analysis on this site is based on Strict Fibonacci Heaps