Fusion Tree - Approximating The Sketch

Approximating The Sketch

If the locations of the sketch bits are b1 < b2 < ··· < br, then the sketch of the key xw-1···x1x0 is the r-bit integer .

With only standard word operations, such those of the C programming language, it is difficult to directly compute the sketch of a key in constant time. Instead, the sketch bits can be packed into a range of size at most r4, using bitwise AND and multiplication. The bitwise AND operation serves to clear all non-sketch bits from the key, while the multiplication shifts the sketch bits into a small range. Like the "perfect" sketch, the approximate sketch preserves the order of the keys.

Some preprocessing is needed to determine the correct multiplication constant. Each sketch bit in location bi will get shifted to bi + mi via a multiplication by m = 2mi. For the approximate sketch to work, the following three properties must hold:

  1. bi + mj are distinct for all pairs (i, j). This will ensure that the sketch bits are uncorrupted by the multiplication.
  2. bi + mj is a strictly increasing function of i. That is, the order of the sketch bits is preserved.
  3. (br + mr) - (b1 - m1) ≤ r4. That is, the sketch bits are packed into a range of size at most r4.

An inductive argument shows how the mi can be constructed. Let m1 = wb1. Suppose that 1 < tr and that m1, m2... mt have already been chosen. Then pick the smallest integer mt such that both properties (1) and (2) are satisfied. Property (1) requires that mtbibj + ml for all 1 ≤ i, jr and 1 ≤ lt-1. Thus, there are less than tr2 ≤ r3 values that mt must avoid. Since mt is chosen to be minimal, (bt + mt) ≤ (bt-1 + mt-1) + r3. This implies Property (3).

The approximate sketch is thus computed as follows:

  1. Mask out all but the sketch bits with a bitwise AND.
  2. Multiply the key be the predetermined constant m. This operation actually requires two machine words, but this can still by done in constant time.
  3. Mask out all but the shifted sketch bits. These are now contained in a contiguous block of at most r4 < w4/5 bits.

For the rest of this article, sketching will be taken to mean approximate sketching.

Read more about this topic:  Fusion Tree

Famous quotes containing the word sketch:

    the vagabond began
    To sketch a face that well might buy the soul of any man.
    Then, as he placed another lock upon the shapely head,
    With a fearful shriek, he leaped and fell across the
    picture—dead.
    Hugh Antoine D’Arcy (1843–1925)