dsu alternatives and similar packages
Based on the "Data Structures" category.
Alternatively, view dsu alternatives based on common mentions on social networks and blogs.
-
golang-set
A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp. -
hyperloglog
HyperLogLog with lots of sugar (Sparse, LogLog-Beta bias correction and TailCut space reduction) brought to you by Axiom -
ttlcache
DISCONTINUED. An in-memory cache with item expiration and generics [Moved to: https://github.com/jellydator/ttlcache] -
Bloomfilter
DISCONTINUED. Face-meltingly fast, thread-safe, marshalable, unionable, probability- and optimal-size-calculating Bloom filter in go -
hilbert
DISCONTINUED. Go package for mapping values to and from space-filling curves, such as Hilbert and Peano curves. -
cuckoo-filter
Cuckoo Filter go implement, better than Bloom Filter, configurable and space optimized 布谷鸟过滤器的Go实现,优于布隆过滤器,可以定制化过滤器参数,并进行了空间优化 -
go-rquad
:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go -
nan
Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers -
hide
A Go type to prevent internal numeric IDs from being exposed to clients using HashIDs and JSON.
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of dsu or a related project?
README
dsu
Implementation of the Disjoint-Set data structure. The Disjoint-Set, Also called a Union-Find or Merge-Find set, is a data structure that stores a collection of disjoint (non-overlapping) sets. Equivalently, it stores a partition of a set into disjoint subsets. It provides operations for adding new sets, merging sets (replacing them by their union), and finding a representative member of a set. The last operation allows to find out efficiently if any two elements are in the same or different sets.
Installation
go get github.com/ihebu/dsu
Documentation
You can check the code documentation here
Usage Example
// Create a new disjoint-set
d := dsu.New()
// Add the elements 1, 2, 3 to the set
d.Add(1)
d.Add(2)
d.Add(3)
// The set is now {1}, {2}, {3}
// Unite the sets {1}, {2}
d.Union(1, 2)
// The set is now {1, 2}, {3}
// Find the representative element of each set
d.Find(1) // returns 2
d.Find(2) // returns 2
d.Find(3) // returns 3
// Check the existence of an element in the set
d.Contains(2) // returns true
d.Contains(54) // returns false
// Note : you can add elements of different type in the set
// Example
d.Add("hello")
d.Add(34.5)
d.Union("hello", 34.5)