GithubHelp home page GithubHelp logo

dlcbf's Introduction

dlCBF

GoDoc

A d-left Counting Bloom Filter (dlCBF) is simple hashing-based Counting Bloom Filter (CBF) alternative based on d-left hashing that offers the same functionality as a CBF, but uses less space, generally saving a factor of two or more.

For details about the algorithm and citations please use this article for now

"Bloom Filters via d-Left Hashing and Dynamic Bit Reassignment Extended Abstract" by Flavio Bonomi, Michael Mitzenmacher, Rina Panigrahy, Sushil Singh and George Varghese

Note:
  • This implmentation currently does not implement the counter feature. (coming soon)
  • Insertions of items that already exists in the filter will fail (item can only exist once).
  • fingerprint size set to a static 16 Bit (also to be changed soon)

Usage

dlcbf, err := NewDlcbfForCapacity(1000000)
	
// Add Item
dlcbf.Add("jon snow is alive")

count := dlcbf.GetCount() // count >> 1

member := dlcbf.IsMember("jon snow is alive") // member = true
	
// Remove Item
dlcbf.Delete("jon snow is alive") // returns true

// Remove Item again
dlcbf.Delete("jon snow is alive") // returns false
	
count := dlcbf.GetCount() // count >> 0

dlcbf's People

Contributors

seiflotfy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dlcbf's Issues

Count test is wrong

count := dlcbf.GetCount()
	if float64(count)*100/235886 < 1 {
		t.Error("Expected error < 1 percent, got", float64(count)*100/235886)
	}

In this logic,
float64(count)*100/235886 < 1 is count*100/235886 < 1,
and this is equal to count/235886 < 1/100, count < 235886/100.
This mean, the count is bigger than 2359, is all OK! This is strange.

Maybe '235886' is web2's size, I will call this Web2Size.
The condition of the if statement should be like this.

if float64(Web2Size - count) * 100 / Web2Size > 1 {
	t.Error(...)
}

or

if ( float64(count) * 100 / Web2Size ) < ( 100 - 1 ) {
	t.Error(...)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.