"BloomFilter" (Data Structure)

"BloomFilter"

represents a set that tests whether elements are definitely not members.

Details

  • A Bloom filter is typically used as a probabilistic set that can test if elements are definitely not members.
  • Testing an element for membership of a Bloom filter will always return False if the element is not a member of the set.
  • Testing an element for membership of a Bloom filter will not always return True if the element is a member of the set:
  • CreateDataStructure[ "BloomFilter",capacity]create a new "BloomFilter" of specified capacity
    Typed[x,"BloomFilter"]give x the type "BloomFilter"
  • For a data structure of type "BloomFilter", the following operations can be used:
  • ds["Capacity"]the storage capacity of dstime: O(1)
    ds["CouldContain",x]return True if ds could contain x and False otherwisetime: O(1)
    ds["Insert",x]insert x into dstime: O(1)
    ds["Visualization"]return a visualization of dstime: O(n)
  • The following functions are also supported:
  • dsi===dsjTrue, if dsi equals dsj
    FullForm[ds]full form of ds
    Information[ds]information about ds
    InputForm[ds]input form of ds
    Normal[ds]convert ds to a normal expression

Examples

open allclose all

Basic Examples  (1)

A new "BloomFilter" can be created with CreateDataStructure:

Any expression can be inserted into a "BloomFilter" data structure:

It is possible to test if an expression is not present. A result of False means that f[2] is definitely not in the set:

A result of True means that f[1] is possibly in the set:

Return an expression version of ds:

A visualization of the data structure can be generated:

Scope  (1)

Information  (1)

A new "BloomFilter" can be created with CreateDataStructure:

Information about the data structure ds:

Introduced in 2020
 (12.1)