Crate flame_clustering

source ·
Expand description

An implementation of the FLAME data clustering algorithm.

Fuzzy clustering by Local Approximation of MEmberships (FLAME) is a data clustering algorithm that defines clusters in the dense parts of a dataset and performs cluster assignment solely based on the neighborhood relationships among objects.

The algorithm was first described in: “FLAME, a novel fuzzy clustering method for the analysis of DNA microarray data”, BMC Bioinformatics, 2007, 8:3. Available from:

This Rust library was adapted from the original C implementation:


use flame_clustering::DistanceGraph;

let data: Vec<f64> = vec![0.12, 0.23, 0.15, 0.19, 100.0];
let (clusters, outliers) = DistanceGraph::build(&data, |a, b| (a - b).abs())
    .find_supporting_objects(2, -1.0)
    .approximate_fuzzy_memberships(100, 1e-6)

assert_eq!(format!("{clusters:?}"), "[[0, 1, 3, 2]]");
assert_eq!(format!("{outliers:?}"), "[4]");


  • A collection of useful distance measures.