This console-based demo allows you to explore Bloom filter variants in real time, observe their bit patterns, and persist or reload filter states between sessions.
mvn clean packagemvn clean package
java -cp target/classes com.bloomfilter.demo.InteractiveBloomDemo=======================================
BLOOM FILTER INTERACTIVE DEMO
=======================================
Switched to classic mode.
>
| Command | Description | ||
|---|---|---|---|
mode <classic partitioned counting> |
Switches the active Bloom filter type | ||
add <word> |
Inserts an element | ||
check <word> |
Tests membership of an element | ||
remove <word> |
Removes an element (Counting only) | ||
clear |
Resets all bits/counters | ||
info |
Shows estimated count and false-positive rate | ||
ingestlist <input.txt> <outputFolder/> |
Loads a word list, creates and saves a standardized binary | ||
save <file> |
Manually saves the active filter state | ||
load <file> |
Loads a legacy .bin file saved by save |
||
loadstd <file> |
Loads a standardized .bin file created by ingestlist |
||
loadmeta <file> |
Displays metadata (algorithm, bit size, hashes, source, timestamp) without loading | ||
crossload <file> |
Hot-swaps the current in-memory filter with a serialized binary (same configuration required) | ||
help |
Displays available commands | ||
exit |
Quits the demo |
The ingestlist command standardizes source text data into persistent .bin filters.
> mode classic
> ingestlist src/main/resources/data/fruit.txt filters/
Produces:
[Standardized binary created] filters/fruit_Classic_m64_k3_v20251028192638.bin
Algorithm=ClassicBloomFilter | Bits=64 | Hashes=3 | Source=src/main/resources/data/fruit.txt
<listName>_<Algorithm>_m<bitArraySize>_k<hashCount>_v<timestamp>.bin
Examples:
fruit_Classic_m64_k3_v20251028192638.bin
fruit_Counting_m64_k3_v20251028192700.bin
fruit_Partitioned_p4x32_k3_v20251028192812.bin
m= total bit array sizep#x#= partitioned filter configuration (partitions ร size)k= number of hash functionsv= creation timestamp (local time,yyyyMMddHHmmss)
Each algorithm uses its own storage layout. โ One text file may be ingested for multiple algorithms. ๐ซ One binary file cannot be used across modes.
Each standardized binary embeds descriptive metadata in the header:
Algorithm=ClassicBloomFilter | Bits=64 | Hashes=3 |
Source=src/main/resources/data/fruit.txt | Created=2025-10-28T19:26:38
This enables:
- Self-documenting filters
- Mode validation on load/crossload
- Clean long-term persistence for experimentation
> mode classic
> ingestlist src/main/resources/data/fruit.txt filters/
> loadstd filters/fruit_Classic_m64_k3_v20251028192638.bin
> check apple
Result: apple โ possibly in set
> mode counting
> ingestlist src/main/resources/data/fruit.txt filters/
> remove apple
> check apple
Result: apple โ definitely not
> save filters/fruit_counting_m64_k3_v20251028192700.bin
-
Verbose mode is automatically enabled for interactive learning, showing each hash, index, and bit operation.
-
All binary filters are portable within this framework version.
-
Cross-mode loading gracefully errors if configuration mismatch occurs, preserving the console session.
-
Planned enhancements for v0.2:
lsfilterscommand to list recent filters- optional JSON metadata export
- Docker sandbox environment for browser-based testing
Bloom Filter Family Educational implementation and visualization framework. Not intended for production โ designed for learning, experimentation, and extension.
This project provides a learning-focused, extensible set of Bloom Filter implementations with full visualization and persistence support.
It allows you to explore the probabilistic behavior of these filters through console interaction, wordlist ingestion, and standardized binary serialization.
| Capability | Description |
|---|---|
| ๐งฉ Modular Filters | ClassicBloomFilter, CountingBloomFilter, PartitionedBloomFilter all implement MembershipFilter<T>. |
| ๐งฎ Hashing | MurmurHash3 (x64/128) via HashUtils for stable, fast indexing. |
| ๐ง Visualization | Real-time console visualization of bit arrays and counters. |
| ๐พ Persistence | Filters can be saved, loaded, or ingested from .txt wordlists as standardized .bin files. |
| ๐งพ Metadata | Each .bin file includes FilterMetadata (algorithm, source, bit size, hash count, timestamp). |
| ๐งโ๐ป Interactive Console | Learn Bloom filters by directly adding, checking, and removing elements. |
bloom_project_extracted/
โ
โโโ README.md
โโโ how_it_started.md
โโโ .gitignore
โโโ pickup-notes-102825.md
โโโ literal_example.md
โโโ LICENSE
โโโ about_bloom_filters.md
โโโ pom.xml
โโโ CHANGELOG.md
โโโ EDUCATIVE.md
โโโ QUICKSTART.md
โ
โโโ .git/
โ โโโ config
โ โโโ HEAD
โ โโโ index
โ โโโ refs/
โ โโโ objects/
โ โโโ hooks/
โ โโโ logs/
โ โโโ branches/
โ
โโโ .idea/
โ โโโ compiler.xml
โ โโโ encodings.xml
โ โโโ misc.xml
โ โโโ modules.xml
โ โโโ vcs.xml
โ โโโ workspace.xml
โ โโโ dictionaries/project.xml
โ
โโโ src/
โ โโโ main/
โ โ โโโ java/com/bloomfilter/
โ โ โ โโโ AbstractBloomFilter.java
โ โ โ โโโ ClassicBloomFilter.java
โ โ โ โโโ CountingBloomFilter.java
โ โ โ โโโ FilterIO.java
โ โ โ โโโ FilterMetadata.java
โ โ โ โโโ HashUtils.java
โ โ โ โโโ MembershipFilter.java
โ โ โ โโโ PartitionedBloomFilter.java
โ โ โ โโโ demo/
โ โ โ โโโ InteractiveBloomDemo.java
โ โ โ โโโ MasterVisualDemo.java
โ โ โ
โ โ โโโ resources/
โ โ โโโ data/
โ โ โ โโโ animals.txt
โ โ โ โโโ cities.txt
โ โ โ โโโ fruit.txt
โ โ โ โโโ random.txt
โ โ โ โโโ uuids.txt
โ โ โ โโโ doc/
โ โ โ โโโ ABOUT_BLOOM_FILTERS.md
โ โ โ โโโ CHANGELOG.md
โ โ โ โโโ PROJECT_ORIGIN.md
โ โ
โ โโโ test/
โ โโโ java/com/bloomfilter/
โ โโโ BloomFilterTest.java
โ โโโ ClassicBloomFilterTest.java
โ โโโ CountingBloomFilterTest.java
โ โโโ HashUtilsTest.java
โ โโโ PartitionedBloomFilterTest.java
โ
โโโ target/
โ โโโ bloom-0.1-SNAPSHOT.jar
โ โโโ classes/...
โ โโโ test-classes/...
โ โโโ surefire-reports/ (JUnit results)
โ โโโ generated-sources/
โ โโโ generated-test-sources/
โ โโโ maven-status/
โ
โโโ filters/
โโโ animals_ClassicBloomFilter_m64_k3_v20251028210153.bin
โโโ animals_CountingBloomFilter_m64_k3_v20251028210218.bin
โโโ animals_PartitionedBloomFilter_p4x32_k3_v20251028210240.bin
โโโ cities_ClassicBloomFilter_m64_k3_v20251028210444.bin
โโโ cities_CountingBloomFilter_m64_k3_v20251028210459.bin
โโโ cities_PartitionedBloomFilter_p4x32_k3_v20251028210507.bin
โโโ fruit_ClassicBloomFilter_m64_k3_v20251028205146.bin
โโโ fruit_CountingBloomFilter_m64_k3_v20251028202122.bin
โโโ fruit_PartitionedBloomFilter_p4x32_k3_v20251028205314.bin
Each .bin file contains:
-
A serialized
FilterMetadataheader:Algorithm=ClassicBloomFilter | Bits=64 | Hashes=3 | Source=data/fruit.txt | Created=2025-10-28T17:30:28 -
A binary-encoded representation of the filterโs internal state (
BitSetor counter array).
This format ensures deterministic, comparable runs across filter variants and datasets.
Run JUnit tests:
mvn testYouโll see console output illustrating the add/check/remove workflow for each filter type, verifying correctness and demonstrating expected FPR behavior.
| Milestone | Description | Status |
|---|---|---|
| v0.1.0 (MVP) | Ingestion, persistence, visualization | โ Complete |
| v0.2.0 | loadmeta (metadata inspection) and enhanced CLI help |
โณ Planned |
| v0.3.0 | Docker containerization for sandboxed demo | โณ Planned |
| v1.0.0 | Documentation, optimization, educational release | โณ Future |
This project is not optimized for production performance or concurrency. It is intentionally verbose, instrumented for learning, and safe for experimentation.
This repository is provided under the MIT License (add LICENSE file if not yet present).
You are free to modify and extend it for educational or research purposes.
Built with persistence and curiosity. Probabilistic data structures in action.