Trait gut::algo::partition::Partition [−][src]
pub trait Partition {
fn partition_by_attrib<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize)
where
T: AttributeValueHash,
Src: AttribIndex<Self>;
fn partition_by_attrib_by_sort<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize)
where
T: PartialOrd<T> + AttributeValue,
Src: AttribIndex<Self>;
}
Required methods
fn partition_by_attrib<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize) where
T: AttributeValueHash,
Src: AttribIndex<Self>,
fn partition_by_attrib<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize) where
T: AttributeValueHash,
Src: AttribIndex<Self>,
Returns a partitioning by unique values of the given attribute.
The returned vector consists of a ID assigned to each Src
element identifying which
partition it belongs to along with the total number of partitions.
The attribute values must have type T
.
If attrib
doesn’t exist at the Src
topology, the returned vector will consist of all
zeros and the number of partitions will be 1.
fn partition_by_attrib_by_sort<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize) where
T: PartialOrd<T> + AttributeValue,
Src: AttribIndex<Self>,
fn partition_by_attrib_by_sort<T, Src>(
&self,
attrib: &str
) -> (Vec<usize, Global>, usize) where
T: PartialOrd<T> + AttributeValue,
Src: AttribIndex<Self>,
Returns a partitioning by unique values of the given attribute.
The returned vector consists of a ID assigned to each Src
element identifying which
partition it belongs to along with the total number of partitions.
The attribute values must have type T
.
If attrib
doesn’t exist at the Src
topology, the returned vector will consist of all
zeros and the number of partitions will be 1.
This version of partition_by_attrib
uses sorting to determine unique values instead of a
HashMap
, and therefore only relies on T
being PartialOrd
but not Eq
and Hash
.