NodeState

Struct NodeState 

Source
pub struct NodeState<'graph, V, G, GH = G> { /* private fields */ }

Implementations§

Source§

impl<'graph, V, G: IntoDynamic, GH: IntoDynamic> NodeState<'graph, V, G, GH>

Source

pub fn into_dyn(self) -> NodeState<'graph, V, DynamicGraph>

Source§

impl<'graph, V, G: GraphViewOps<'graph>> NodeState<'graph, V, G>

Source

pub fn new_from_eval(graph: G, values: Vec<V>) -> Self
where V: Clone,

Construct a node state from an eval result

§Arguments
  • graph: the graph view
  • values: the unfiltered values (i.e., values.len() == graph.unfiltered_num_nodes()). This method handles the filtering.
Source

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 view
  • values: the unfiltered values (i.e., values.len() == graph.unfiltered_num_nodes()). This method handles the filtering.
  • map: Closure mapping input to output values
Source

pub fn new_empty(graph: G) -> Self

create a new empty NodeState

Source

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)

Source

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>

Source

pub fn new( base_graph: G, graph: GH, values: Arc<[V]>, keys: Option<Index<VID>>, ) -> Self

Source

pub fn into_inner(self) -> (Arc<[V]>, Option<Index<VID>>)

Source

pub fn values(&self) -> &Arc<[V]>

Trait Implementations§

Source§

impl<'graph, V: Clone, G: Clone, GH: Clone> Clone for NodeState<'graph, V, G, GH>

Source§

fn clone(&self) -> NodeState<'graph, V, G, GH>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'graph, V: Debug + Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: Debug + GraphViewOps<'graph>> Debug for NodeState<'graph, V, G, GH>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'graph, V: Send + Sync + Clone + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> IntoIterator for NodeState<'graph, V, G, GH>

Source§

type Item = (NodeView<'graph, G, GH>, V)

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = <NodeState<'graph, V, G, GH> as IntoIterator>::Item> + 'graph>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>> NodeStateOps<'graph> for NodeState<'graph, V, G, GH>

Source§

type Graph = GH

Source§

type BaseGraph = G

Source§

type Value<'a> = &'a V where 'graph: 'a

Source§

type OwnedValue = V

Source§

fn graph(&self) -> &Self::Graph

Source§

fn base_graph(&self) -> &Self::BaseGraph

Source§

fn iter_values<'a>(&'a self) -> impl Iterator<Item = Self::Value<'a>> + 'a
where 'graph: 'a,

Source§

fn par_iter_values<'a>( &'a self, ) -> impl ParallelIterator<Item = Self::Value<'a>> + 'a
where 'graph: 'a,

Source§

fn into_iter_values(self) -> impl Iterator<Item = Self::OwnedValue> + 'graph

Source§

fn into_par_iter_values( self, ) -> impl ParallelIterator<Item = Self::OwnedValue> + 'graph

Source§

fn iter<'a>( &'a self, ) -> impl Iterator<Item = (NodeView<'a, &'a Self::BaseGraph, &'a Self::Graph>, Self::Value<'a>)> + 'a
where 'graph: 'a,

Source§

fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Graph>

Source§

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,

Source§

fn get_by_index( &self, index: usize, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>

Source§

fn get_by_node<N: AsNodeRef>(&self, node: N) -> Option<Self::Value<'_>>

Source§

fn len(&self) -> usize

Source§

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>

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>

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>

Retrieves the top-k elements from the AlgorithmResult based on its values. Read more
Source§

fn bottom_k_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, k: usize, ) -> NodeState<'graph, Self::OwnedValue, Self::BaseGraph, Self::Graph>

Source§

fn min_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>

Source§

fn max_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>

Source§

fn median_item_by<F: Fn(&Self::OwnedValue, &Self::OwnedValue) -> Ordering + Sync>( &self, cmp: F, ) -> Option<(NodeView<'_, &Self::BaseGraph, &Self::Graph>, Self::Value<'_>)>

Source§

fn group_by<V: Hash + Eq + Send + Sync + Clone + Debug, F: Fn(&Self::OwnedValue) -> V + Sync>( &self, group_fn: F, ) -> NodeGroups<V, Self::Graph>

Source§

fn sum<'a, S>(&'a self) -> S
where S: Send + Sum<Self::Value<'a>> + Sum<S>, 'graph: 'a,

Source§

fn mean<'a>(&'a self) -> f64
where Self::OwnedValue: Sum<Self::Value<'a>> + Sum + AsPrimitive<f64>, 'graph: 'a,

Source§

impl<'graph, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G, GH> PartialEq<&[RHS]> for NodeState<'graph, V, G, GH>

Source§

fn eq(&self, other: &&[RHS]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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>

Source§

fn eq(&self, other: &HashMap<K, RHS, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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>

Source§

fn eq(&self, other: &RHS) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'graph, RHS: Send + Sync, V: PartialEq<RHS> + Send + Sync + Clone + 'graph, G, GH> PartialEq<Vec<RHS>> for NodeState<'graph, V, G, GH>

Source§

fn eq(&self, other: &Vec<RHS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<'graph, V, G, GH> Freeze for NodeState<'graph, V, G, GH>
where G: Freeze, GH: Freeze,

§

impl<'graph, V, G, GH> RefUnwindSafe for NodeState<'graph, V, G, GH>

§

impl<'graph, V, G, GH> Send for NodeState<'graph, V, G, GH>
where G: Send, GH: Send, V: Sync + Send,

§

impl<'graph, V, G, GH> Sync for NodeState<'graph, V, G, GH>
where G: Sync, GH: Sync, V: Sync + Send,

§

impl<'graph, V, G, GH> Unpin for NodeState<'graph, V, G, GH>
where G: Unpin, GH: Unpin,

§

impl<'graph, V, G, GH> UnwindSafe for NodeState<'graph, V, G, GH>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'graph, V> AsOrderedNodeStateOps<'graph> for V
where V: NodeStateOps<'graph>, &'a <V as NodeStateOps<'graph>>::OwnedValue: for<'a> AsOrd,

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>

Sorts the AlgorithmResult by its values in ascending or descending order. Read more
Source§

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 more
Source§

fn 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<'_>)>

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<'_>)>

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<'_>)>

Returns a tuple of the median result with its key
Source§

fn min(&self) -> Option<Self::Value<'_>>

Min result. Read more
Source§

fn max(&self) -> Option<Self::Value<'_>>

Source§

fn median(&self) -> Option<Self::Value<'_>>

Returns: PropValue:
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> StateType for T
where T: PartialEq + Clone + Debug + Send + Sync + 'static,