pub struct NodeState<'graph, V, G, GH = G> { /* private fields */ }Implementations§
Source§impl<'graph, V, G: IntoDynamic, GH: IntoDynamic> NodeState<'graph, V, G, GH>
impl<'graph, V, G: IntoDynamic, GH: IntoDynamic> NodeState<'graph, V, G, GH>
pub fn into_dyn(self) -> NodeState<'graph, V, DynamicGraph>
Source§impl<'graph, V, G: GraphViewOps<'graph>> NodeState<'graph, V, G>
impl<'graph, V, G: GraphViewOps<'graph>> NodeState<'graph, V, G>
Sourcepub fn new_from_eval(graph: G, values: Vec<V>) -> Selfwhere
V: Clone,
pub fn new_from_eval(graph: G, values: Vec<V>) -> Selfwhere
V: Clone,
Construct a node state from an eval result
§Arguments
graph: the graph viewvalues: the unfiltered values (i.e.,values.len() == graph.unfiltered_num_nodes()). This method handles the filtering.
Sourcepub fn new_from_eval_mapped<R: Clone>(
graph: G,
values: Vec<R>,
map: impl Fn(R) -> V,
) -> Self
pub fn new_from_eval_mapped<R: Clone>( graph: G, values: Vec<R>, map: impl Fn(R) -> V, ) -> Self
Construct a node state from an eval result, mapping values
§Arguments
graph: the graph viewvalues: the unfiltered values (i.e.,values.len() == graph.unfiltered_num_nodes()). This method handles the filtering.map: Closure mapping input to output values
Sourcepub fn new_from_values(graph: G, values: impl Into<Arc<[V]>>) -> Self
pub fn new_from_values(graph: G, values: impl Into<Arc<[V]>>) -> Self
create a new NodeState from a list of values for the node (takes care of creating an index for node filtering when needed)
Sourcepub fn new_from_map<R, S: BuildHasher>(
graph: G,
values: HashMap<VID, R, S>,
map: impl Fn(R) -> V,
) -> Self
pub fn new_from_map<R, S: BuildHasher>( graph: G, values: HashMap<VID, R, S>, map: impl Fn(R) -> V, ) -> Self
create a new NodeState from a HashMap of values
Source§impl<'graph, V, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> NodeState<'graph, V, G, GH>
impl<'graph, V, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> NodeState<'graph, V, G, GH>
Trait Implementations§
Source§impl<'graph, V: Debug + Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: Debug + GraphViewOps<'graph>> Debug for NodeState<'graph, V, G, GH>
impl<'graph, V: Debug + Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: Debug + GraphViewOps<'graph>> Debug for NodeState<'graph, V, G, GH>
Source§impl<'graph, V: Send + Sync + Clone + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> IntoIterator for NodeState<'graph, V, G, GH>
impl<'graph, V: Send + Sync + Clone + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> IntoIterator for NodeState<'graph, V, G, GH>
Source§impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> NodeStateOps<'graph> for NodeState<'graph, V, G, GH>
impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> NodeStateOps<'graph> for NodeState<'graph, V, G, GH>
type Graph = GH
type BaseGraph = G
type Value<'a> = &'a V where 'graph: 'a
type OwnedValue = V
fn graph(&self) -> &Self::Graph
fn base_graph(&self) -> &Self::BaseGraph
fn iter_values<'a>(&'a self) -> impl Iterator<Item = Self::Value<'a>> + 'awhere
'graph: 'a,
fn par_iter_values<'a>(
&'a self,
) -> impl ParallelIterator<Item = Self::Value<'a>> + 'awhere
'graph: 'a,
fn into_iter_values(self) -> impl Iterator<Item = Self::OwnedValue> + 'graph
fn into_par_iter_values( self, ) -> impl ParallelIterator<Item = Self::OwnedValue> + 'graph
fn iter<'a>(
&'a self,
) -> impl Iterator<Item = (NodeView<'a, &'a Self::BaseGraph, &'a Self::Graph>, Self::Value<'a>)> + 'awhere
'graph: 'a,
fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Graph>
fn par_iter<'a>(
&'a self,
) -> impl ParallelIterator<Item = (NodeView<'a, &'a <Self as NodeStateOps<'graph>>::BaseGraph, &'a <Self as NodeStateOps<'graph>>::Graph>, <Self as NodeStateOps<'graph>>::Value<'a>)>where
'graph: 'a,
fn get_by_index( &self, index: usize, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>
fn get_by_node<N: AsNodeRef>(&self, node: N) -> Option<Self::Value<'_>>
fn len(&self) -> usize
fn sort_by<F: Fn((NodeView<'_, &Self::BaseGraph, &Self::Graph>, &Self::OwnedValue), (NodeView<'_, &Self::BaseGraph, &Self::Graph>, &Self::OwnedValue)) -> Ordering + Sync>( &self, cmp: F, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
Source§fn sort_by_values_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>(
&self,
cmp: F,
) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
fn sort_by_values_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
Sorts the by its values in ascending or descending order. Read more
Source§fn sort_by_id(
&self,
) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
fn sort_by_id( &self, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
Sort the results by global node id
Source§fn top_k_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>(
&self,
cmp: F,
k: usize,
) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
fn top_k_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, k: usize, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
Retrieves the top-k elements from the
AlgorithmResult based on its values. Read morefn bottom_k_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, k: usize, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>
fn min_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>
fn max_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>
fn median_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>
fn group_by<V: Hash + Eq + Send + Sync + Clone + Debug, F: Fn(&Self::OwnedValue) -> V + Sync>( &self, group_fn: F, ) -> NodeGroups<V, Self::Graph>
fn sum<'a, S>(&'a self) -> S
fn mean<'a>(&'a self) -> f64
Source§impl<'graph, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G, GH> PartialEq<&[RHS]> for NodeState<'graph, V, G, GH>
impl<'graph, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G, GH> PartialEq<&[RHS]> for NodeState<'graph, V, G, GH>
Source§impl<'graph, K: AsNodeRef, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, S> PartialEq<HashMap<K, RHS, S>> for NodeState<'graph, V, G, GH>
impl<'graph, K: AsNodeRef, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, S> PartialEq<HashMap<K, RHS, S>> for NodeState<'graph, V, G, GH>
Source§impl<'graph, V: Clone + Send + Sync + PartialEq + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, RHS: NodeStateOps<'graph, OwnedValue = V>> PartialEq<RHS> for NodeState<'graph, V, G, GH>
impl<'graph, V: Clone + Send + Sync + PartialEq + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, RHS: NodeStateOps<'graph, OwnedValue = V>> PartialEq<RHS> for NodeState<'graph, V, G, GH>
Auto Trait Implementations§
impl<'graph, V, G, GH> Freeze for NodeState<'graph, V, G, GH>
impl<'graph, V, G, GH> RefUnwindSafe for NodeState<'graph, V, G, GH>
impl<'graph, V, G, GH> Send for NodeState<'graph, V, G, GH>
impl<'graph, V, G, GH> Sync for NodeState<'graph, V, G, GH>
impl<'graph, V, G, GH> Unpin for NodeState<'graph, V, G, GH>
impl<'graph, V, G, GH> UnwindSafe for NodeState<'graph, V, G, GH>
Blanket Implementations§
Source§impl<'graph, V> AsOrderedNodeStateOps<'graph> for V
impl<'graph, V> AsOrderedNodeStateOps<'graph> for V
Source§fn sort_by_values(
&self,
reverse: bool,
) -> NodeState<'graph, <V as NodeStateOps<'graph>>::OwnedValue, <V as NodeStateOps<'graph>>::BaseGraph, <V as NodeStateOps<'graph>>::Graph>
fn sort_by_values( &self, reverse: bool, ) -> NodeState<'graph, <V as NodeStateOps<'graph>>::OwnedValue, <V as NodeStateOps<'graph>>::BaseGraph, <V as NodeStateOps<'graph>>::Graph>
Sorts the
AlgorithmResult by its values in ascending or descending order. Read moreSource§fn top_k(
&self,
k: usize,
) -> NodeState<'graph, <V as NodeStateOps<'graph>>::OwnedValue, <V as NodeStateOps<'graph>>::BaseGraph, <V as NodeStateOps<'graph>>::Graph>
fn top_k( &self, k: usize, ) -> NodeState<'graph, <V as NodeStateOps<'graph>>::OwnedValue, <V as NodeStateOps<'graph>>::BaseGraph, <V as NodeStateOps<'graph>>::Graph>
Retrieves the top-k elements from the
AlgorithmResult based on its values. Read morefn bottom_k( &self, k: usize, ) -> NodeState<'graph, <V as NodeStateOps<'graph>>::OwnedValue, <V as NodeStateOps<'graph>>::BaseGraph, <V as NodeStateOps<'graph>>::Graph>
Source§fn min_item(
&self,
) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
fn min_item( &self, ) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
Returns a tuple of the min result with its key
Source§fn max_item(
&self,
) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
fn max_item( &self, ) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
Returns a tuple of the max result with its key
Source§fn median_item(
&self,
) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
fn median_item( &self, ) -> Option<(NodeView<'_, &<V as NodeStateOps<'graph>>::BaseGraph, &<V as NodeStateOps<'graph>>::Graph>, <V as NodeStateOps<'graph>>::Value<'_>)>
Returns a tuple of the median result with its key
fn max(&self) -> Option<Self::Value<'_>>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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