The Deletable Bloom Filter (DlBF) is a data structure built on the idea of efficiently removing items from a Bloom filter when they are no longer needed. It leverages the fact that bits set by only one item can be safely deleted. This README provides an overview of how the DlBF works and its key concepts.
- DlBF tracks bit collisions when inserting items.
- It encodes regions of deletable bits efficiently, using a fraction of the filter memory.
- An item can be removed if at least one of its bits is in a collision-free region.
- Bit Array: The DlBF uses a bit array of size
m
. - Regions: The bit array is divided into
r
regions, each withm'
bits. - Collision Bitmap: A bitmap of size
r
marks collision-free regions with 0 and regions with collisions with 1.
Insert(x)
: Maps an itemx
tok
bit positions using independent hashes. If a bit is already set (collision), the corresponding region is marked as non-deletable.Query(x)
: Checks if thek
bit positions are set to 1.Remove(x)
: Clears only those bit positions amongk
located in collision-free zones.
- Avoids false negatives at the cost of some items not being deletable (counted as false positives).
- The choice of the parameter
r
is critical, affecting deletability and false positive behavior.
To use the Deletable Bloom Filter in your applications, consider the following steps:
- Create a DlBF instance using the desired size, hash seeds, and the number of regions.
- Use
Put(x)
to insert elements,Check(x)
to check existence, andDelete(x)
to remove elements.
// Example Rust code (not provided in this README)
// Create a Deletable Bloom Filter
let mut dlbf = DeletableBloomFilter::new(size, hash_seeds, num_regions);
// Insert an element
dlbf.put(&element);
// Check if an element exists
let exists = dlbf.check(&element);
// Remove an element
let removed = dlbf.delete(&element);
In dynamic applications with frequent insertions and deletions, non-removable bits may accumulate, leading to increased false positives.
The choice of the r parameter is crucial, as it impacts the filter's performance in terms of deletability and false positives. You may need to adjust this parameter based on your specific use case.
Here is the original research paper - The Deletable Bloom filter