pub struct MapReduceBuilder<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer, L: Labels> {
pub map_reducer: MR,
/* private fields */
}Expand description
Builder for MapReduce
Fields§
§map_reducer: MRImplementations§
Source§impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: Sized>> MapReduceBuilder<G, MR, SparseLabels<MR::Label>>
impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: Sized>> MapReduceBuilder<G, MR, SparseLabels<MR::Label>>
Sourcepub fn new_sparse(graph: G, map_reducer: MR) -> Self
pub fn new_sparse(graph: G, map_reducer: MR) -> Self
Stores labels in a HashMap. This is the best when labeling the history-hosting layer
This improves memory usage at the expense of runtime and CPU use.
Source§impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: Default + Clone + Sized>> MapReduceBuilder<G, MR, DenseLabels<MR::Label>>
impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: Default + Clone + Sized>> MapReduceBuilder<G, MR, DenseLabels<MR::Label>>
Sourcepub fn new_dense(graph: G, map_reducer: MR) -> Self
pub fn new_dense(graph: G, map_reducer: MR) -> Self
Stores labels in an array instead of a HashMap. This is the best when labeling the directory layer or the whole graph.
This improves runtime and CPU use at the expense of memory.
This should probably be used only if:
- labels are small, or
- computed labels are sparse (wrt.
graph.num_nodes()) andNone::<MR::Label>is small
Source§impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: StridableLabel>> MapReduceBuilder<G, MR, StriddenLabels<MR::Label>>
impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer<Label: StridableLabel>> MapReduceBuilder<G, MR, StriddenLabels<MR::Label>>
Sourcepub fn new_stridden(graph: G, map_reducer: MR, num_words: usize) -> Self
pub fn new_stridden(graph: G, map_reducer: MR, num_words: usize) -> Self
Specialized variant of new_labels for non-Sized labels.
All labels must have the same length, but it can be computed at runtime.
Like Self::new_dense, this improves runtime and CPU use at the expense of memory,
but less than boxing the values would.
This should only be used if labels are small.
num_words is the length of the [Label::Word] slice needed to store a label.
Source§impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer, L: Labels<Label = MR::Label>> MapReduceBuilder<G, MR, L>
impl<G: SwhForwardGraph + SwhBackwardGraph, MR: MapReducer, L: Labels<Label = MR::Label>> MapReduceBuilder<G, MR, L>
pub fn num_nodes(self, num_nodes: usize) -> Self
Sourcepub fn cheap_clones(self, cheap_clones: bool) -> Self
pub fn cheap_clones(self, cheap_clones: bool) -> Self
Tunes the algorithm to assume labels are cheap to clone.
This is probably true if and only if the labels implement Copy.
Setting this to true does not imply they are cheap to move.
Defaults to false.
Sourcepub fn keep_labels(self, keep_labels: bool) -> Self
pub fn keep_labels(self, keep_labels: bool) -> Self
Whether the algorithm should keep labels in its store in order to return them at the end
This is incompatible with cheap_clones(false) (the default).
This consumes extra memory, except when with_labels_array() and labels do not contain
heap-allocated data.
Defaults to false.
pub fn build(self) -> Result<MapReduce<G, MR, L>>
Auto Trait Implementations§
impl<G, MR, L> Freeze for MapReduceBuilder<G, MR, L>
impl<G, MR, L> RefUnwindSafe for MapReduceBuilder<G, MR, L>
impl<G, MR, L> Send for MapReduceBuilder<G, MR, L>
impl<G, MR, L> Sync for MapReduceBuilder<G, MR, L>
impl<G, MR, L> Unpin for MapReduceBuilder<G, MR, L>
impl<G, MR, L> UnsafeUnpin for MapReduceBuilder<G, MR, L>
impl<G, MR, L> UnwindSafe for MapReduceBuilder<G, MR, L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more