Crate fuzzy_dbscan

source ·
Expand description

An implementation of the FuzzyDBSCAN algorithm.

Example

extern crate fuzzy_dbscan;

#[derive(Debug)]
struct Point {
    x: f64,
    y: f64,
}

impl fuzzy_dbscan::MetricSpace for Point {
    fn distance(&self, other: &Self) -> f64 {
        ((other.x - self.x).powi(2) + (other.y - self.y).powi(2)).sqrt()
    }
}

fn main() {
    let points = vec![
        Point { x: 0.0, y: 0.0 },
        Point { x: 100.0, y: 100.0 },
        Point { x: 105.0, y: 105.0 },
        Point { x: 115.0, y: 115.0 },
    ];

    let fuzzy_dbscan = fuzzy_dbscan::FuzzyDBSCAN {
        eps_min: 10.0,
        eps_max: 20.0,
        pts_min: 1.0,
        pts_max: 2.0,
    };

    println!("{:?}", fuzzy_dbscan.cluster(&points));
}

Structs

An element of a cluster.
An instance of the FuzzyDBSCAN algorithm.

Enums

A high-level classification, as defined by the FuzzyDBSCAN algorithm.

Traits

A trait to compute distances between points.

Type Definitions

A group of assigned points.