Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/znrm/disjoint-hash-set
Incremental tracking of connected components identified by hash.
https://github.com/znrm/disjoint-hash-set
data-structures disjoint-sets rust rust-data-stuctures union-find
Last synced: about 6 hours ago
JSON representation
Incremental tracking of connected components identified by hash.
- Host: GitHub
- URL: https://github.com/znrm/disjoint-hash-set
- Owner: znrm
- License: cc0-1.0
- Created: 2021-05-22T20:19:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T10:31:01.000Z (5 months ago)
- Last Synced: 2024-11-10T05:24:02.361Z (7 days ago)
- Topics: data-structures, disjoint-sets, rust, rust-data-stuctures, union-find
- Language: Rust
- Homepage: https://crates.io/crates/disjoint-hash-set
- Size: 1.05 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# disjoint-hash-set
A Rust implementation of a disjoint set / union-find data structure for incremental tracking of connected components identified by their hash.
Incorporates rank-based set joins and path compression to ensure the asymptotically optimal time complexity associated with union-find algorithms.
**See the [reference docs](https://docs.rs/disjoint-hash-set) for examples, typical usage, and detailed documentation.**
```rust
use disjoint_hash_set::DisjointHashSet;let mut djhs = DisjointHashSet::new();
djhs.link("hello", "hi");
djhs.link("hello", "👋");
assert!(djhs.is_linked("hi", "👋"));// `DisjointHashSet` can be built from an iterator of edges
let djhs = vec![("a", "b"), ("a", "c"), ("d", "e"), ("f", "f")]
.into_iter()
.collect::>();// Consume djhs to iterate over each disjoint set
let sets = djhs.sets(); // looks like [{"a", "b", "c"}, {"d", "e"}, {"f"}]
assert_eq!(sets.count(), 3);
```Issues, requests, contributions, and general feedback are welcome.