Partition

Trait Partition 

Source
pub trait Partition<M> {
    type Metadata;
    type Error;

    // Required method
    fn partition(
        &mut self,
        part_ids: &mut [usize],
        data: M,
    ) -> Result<Self::Metadata, Self::Error>;
}
Expand description

The Partition trait allows for partitioning data.

Partitioning algorithms implement this trait.

The generic argument M defines the input of the algorithms (e.g. an adjacency matrix or a 2D set of points).

The input partition must be of the correct size and its contents may or may not be used by the algorithms.

Required Associated Types§

Source

type Metadata

Diagnostic data returned for a specific run of the algorithm.

Source

type Error

Error details, should the algorithm fail to run.

Required Methods§

Source

fn partition( &mut self, part_ids: &mut [usize], data: M, ) -> Result<Self::Metadata, Self::Error>

Partition the given data and output the part ID of each element in part_ids.

Part IDs must be contiguous and start from zero, meaning the number of parts is one plus the maximum of part_ids. If a lower ID does not appear in the array, the part is assumed to be empty.

Implementors§

Source§

impl<'a> Partition<(CsMatBase<f64, usize, &'a [usize], &'a [usize], &'a [f64]>, &'a [f64])> for KernighanLin

Source§

impl<'a, W> Partition<&'a [W]> for VnFirst
where W: VnFirstWeight,

Source§

impl<'a, W> Partition<(CsMatBase<f64, usize, &'a [usize], &'a [usize], &'a [f64]>, W)> for GraphGrowth
where W: AsRef<[f64]>,

Source§

impl<'a, W> Partition<(CsMatBase<i64, usize, &'a [usize], &'a [usize], &'a [i64]>, &'a [W])> for FiducciaMattheyses
where W: FmWeight,

Source§

impl<'a, const D: usize> Partition<&'a [Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>]> for ZCurve
where Const<D>: DimSub<Const<1>> + ToTypenum, DefaultAllocator: Allocator<f64, Const<D>, Const<D>, Buffer = ArrayStorage<f64, D, D>> + Allocator<f64, DimDiff<Const<D>, Const<1>>>,

Source§

impl<'a, const D: usize> Partition<(&'a [Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>], &'a [f64])> for KMeans
where Const<D>: DimSub<Const<1>>, DefaultAllocator: Allocator<f64, Const<D>, Const<D>, Buffer = ArrayStorage<f64, D, D>> + Allocator<f64, DimDiff<Const<D>, Const<1>>>,

Source§

impl<'a, const D: usize> Partition<(&'a [Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>], &'a [f64])> for MultiJagged

Source§

impl<'a, const D: usize, W> Partition<(&'a [Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>], W)> for Rib

Source§

impl<P, W> Partition<(P, W)> for HilbertCurve
where P: AsRef<[Point2D]>, W: AsRef<[f64]>,

Source§

impl<R> Partition<()> for Random<R>
where R: Rng,

Source§

impl<W> Partition<W> for CompleteKarmarkarKarp
where W: IntoIterator, W::Item: CkkWeight,

Source§

impl<W> Partition<W> for Greedy

Source§

impl<W> Partition<W> for KarmarkarKarp

Source§

impl<W> Partition<W> for VnBest

Source§

impl<const D: usize, P, W> Partition<(P, W)> for Rcb