RankedNodes

Struct RankedNodes 

Source
pub struct RankedNodes<'a, T: Eq + Hash + Clone> { /* private fields */ }
Expand description

Holds the result of a ranking algorithm that was run on a Graph.

Implementations§

Source§

impl<'a, T: Eq + Hash + Clone> RankedNodes<'a, T>

Source

pub fn hash_map(&self) -> HashMap<T, f32>

Returns a hash map that maps node data to the resulting score

Source

pub fn unsorted_iter(&'a self) -> UnsortedRankedNodesIter<'a, T>

Returns an unsorted iterator over all nodes and their scores (&data, score).

This is useful for building maps and filtering by data aspects before sorting.

Source

pub fn sorted_iter(&'a self) -> SortedRankedNodesIter<'a, T>

Returns a sorted iterator over all nodes and their scores (&data, score).

The highest scores are sorted first.

This is useful for getting the top n results of the ranking.

Source

pub fn get_score_for(&self, data: &T) -> Option<f32>

Convenience function to look the score of a single data point

This is useful if one only needs the scores for a few specific data points.

Source

pub fn len(&self) -> usize

Returns the number of scores in this result set.

This is usually the number of nodes in the graph.

Source

pub fn is_empty(&self) -> bool

Wheter the result set is empty.

Auto Trait Implementations§

§

impl<'a, T> Freeze for RankedNodes<'a, T>

§

impl<'a, T> RefUnwindSafe for RankedNodes<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for RankedNodes<'a, T>
where T: Sync,

§

impl<'a, T> Sync for RankedNodes<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for RankedNodes<'a, T>

§

impl<'a, T> UnwindSafe for RankedNodes<'a, T>
where T: RefUnwindSafe,

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.