Skip to main content

Affectation

Trait Affectation 

Source
pub trait Affectation<DataId, DataLabel> {
    // Required methods
    fn get_affectation(&self, dataid: DataId) -> DataLabel;
    fn get_nb_points(&self) -> usize;
    fn iter(&self) -> impl Iterator<Item = (DataId, DataLabel)>;
}
Expand description

The cluster affectation of any clustering scheme should be able to provide a structure implementing this trait.

Typically an affectation abstract a clusterization as something giving the label or the rank of the cluster attached to a dataid.
The DataId should satisfy the Hash trait. Morally The label is a discrete value (satisfy the PrimInt + Unsigned trait).

Required Methods§

Source

fn get_affectation(&self, dataid: DataId) -> DataLabel

given a dataId, returns its label or cluster Id

Source

fn get_nb_points(&self) -> usize

returns number of points in clusters

Source

fn iter(&self) -> impl Iterator<Item = (DataId, DataLabel)>

iterator on couples (dataid, label)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<DataId, DataLabel> Affectation<DataId, DataLabel> for DashAffectation<'_, DataId, DataLabel>
where DataId: Hash + Eq + Copy + Clone + Send + Sync + Debug, DataLabel: Hash + Eq + Copy + Clone + Send + Sync + Debug,

Source§

impl<DataId, DataLabel> Affectation<DataId, DataLabel> for HashAffectation<DataId, DataLabel>
where DataId: Hash + Eq + Copy + Clone + Send + Sync + Debug, DataLabel: Hash + Eq + Copy + Clone + Send + Sync + Debug,

Source§

impl<DataLabel> Affectation<usize, DataLabel> for VecAffectation<DataLabel>
where DataLabel: Hash + Eq + Copy + Clone + Send + Sync + Debug,