Cuckoo Filter
From Wikipedia, the free encyclopedia
A cuckoo filter is a space-efficient probabilistic data structure that is used to test whether an element is a member of a set, like a Bloom filter does. False positive matches are possible, but false negatives are not – in other words, a query returns either "possibly in set" or "definitely not in set". A cuckoo filter can also delete existing items, which is not supported by Bloom filters. In addition, for applications that store many items and target moderately low false positive rates, cuckoo filters can achieve lower space overhead than space-optimized Bloom filters.[1]
Cuckoo filters were first described in 2014.[2]
Algorithm description
[edit]
A cuckoo filter uses a hash table based on cuckoo hashing to store the fingerprints of items.[2] The data structure is broken into buckets of some size . To insert the fingerprint of an item , one first computes two potential buckets and where could go. These buckets are calculated using the formula
Note that, due to the symmetry of the XOR operation, one can compute from , and from . As defined above, ; it follows that . These properties are what make it possible to store the fingerprints with cuckoo hashing.
The fingerprint of is placed into one of buckets and . If the buckets are full, then one of the fingerprints in the bucket is evicted using cuckoo hashing, and placed into the other bucket where it can go. If that bucket, in turn, is also full, then that may trigger another eviction, etc.
The hash table can achieve both high utilization (thanks to cuckoo hashing), and compactness because only fingerprints are stored. Lookup and delete operations of a cuckoo filter are straightforward.[2]
There are a maximum of two buckets to check by and . If found, the appropriate lookup or delete operation can be performed in time. Often, in practice, is a constant.
In order for the hash table to offer theoretical guarantees, the fingerprint size must be at least bits.[2][3][4] Subject to this constraint, cuckoo filters guarantee a false-positive rate of at most .[2]
Comparison to Bloom filters
[edit]
A cuckoo filter is similar to a Bloom filter in that they both are fast and compact, and they may both return false positives as answers to set-membership queries:
- ^ Michael D. Mitzenmacher. "Bloom Filters, Cuckoo Hashing, Cuckoo Filters, Adaptive Cuckoo Filters, and Learned Bloom Filters".
- ^ a b c d e f g Fan, Bin; Andersen, Dave G.; Kaminsky, Michael; Mitzenmacher, Michael D. (2014). Cuckoo filter: Practically better than Bloom. Proc. 10th ACM International on Conference on Emerging Networking Experiments and Technologies (CoNEXT '14). Sydney, Australia. pp. 75–88. doi:10.1145/2674005.2674994. ISBN 9781450332798.
- ^ Eppstein, David (22 June 2016). Cuckoo filter: Simplification and analysis. Proc. 15th Scandinavian Symposium and Workshops on Algorithm Theory (SWAT 2016). Leibniz International Proceedings in Informatics (LIPIcs). Vol. 53. Reykjavik, Iceland. pp. 8:1–8:12. arXiv:1604.06067. doi:10.4230/LIPIcs.SWAT.2016.8.
- ^ Fleming, Noah (17 May 2018). Cuckoo Hashing and Cuckoo Filters (PDF) (Technical report). University of Toronto.
- ^ Pagh, Rasmus; Rodler, Flemming Friche (2001). "Cuckoo hashing". Proc. 9th Annual European Symposium on Algorithms (ESA 2001). Lecture Notes in Computer Science. Vol. 2161. Århus, Denmark. pp. 121–133. doi:10.1007/3-540-44676-1_10. ISBN 978-3-540-42493-2.