| Crates.io | single-clustering |
| lib.rs | single-clustering |
| version | 0.6.1 |
| created_at | 2025-04-29 11:59:26.268358+00 |
| updated_at | 2025-09-11 13:01:45.471197+00 |
| description | A high-performance network clustering library implementing community detection algorithms like Louvain and Leiden. Features efficient graph representation, abstract grouping systems, and K-NN graph creation from high-dimensional data. Provides parallel computation support via Rayon for handling large networks. |
| homepage | https://singlerust.com |
| repository | https://github.com/SingleRust/single-clustering |
| max_upload_size | |
| id | 1653459 |
| size | 206,124 |
⚠️ Development Status: This library is currently under heavy development and should not be considered production ready. APIs may change significantly between versions.
A Rust library for community detection and graph clustering algorithms with a focus on performance and flexibility.
use single_clustering::network::CSRNetwork;
use single_clustering::community_search::leiden::{LeidenOptimizer, LeidenConfig};
use single_clustering::community_search::leiden::partition::ModularityPartition;
// Create a CSR network from your data
let network = CSRNetwork::new(edges, weights, node_count);
// Configure the Leiden algorithm
let config = LeidenConfig {
max_iterations: 100,
tolerance: 1e-6,
seed: Some(42),
..Default::default()
};
// Initialize the optimizer
let mut optimizer = LeidenOptimizer::new(config);
// Find communities using modularity optimization
let partition: ModularityPartition<f64, _> = optimizer.find_partition(network)?;
// Access results
for node in 0..partition.node_count() {
println!("Node {} is in community {}", node, partition.membership(node));
}
println!("Modularity: {:.4}", partition.quality());
Add this to your Cargo.toml:
[dependencies]
single-clustering = "0.6.0"
This project is in active development. Contributions, bug reports, and feature requests are welcome!
This crate is licensed under the BSD 3-Clause License.