Struct HyperBall

Source
pub struct HyperBall<'a, G1: RandomAccessGraph + Sync, G2: RandomAccessGraph + Sync, D: Succ<Input = usize, Output = usize>, L: MergeEstimationLogic<Item = G1::Label> + Sync, A: EstimatorArrayMut<L>> { /* private fields */ }
Expand description

An algorithm that computes an approximation of the neighborhood function, of the size of the reachable sets, and of (discounted) positive geometric centralities of a graph.

Implementations§

Source§

impl<G1: RandomAccessGraph + Sync, G2: RandomAccessGraph + Sync, D: Succ<Input = usize, Output = usize> + Sync, L: MergeEstimationLogic<Item = usize> + Sync, A: EstimatorArrayMut<L> + Sync + AsSyncArray<L>> HyperBall<'_, G1, G2, D, L, A>
where L::Backend: PartialEq,

Source

pub fn run( &mut self, upper_bound: usize, threshold: Option<f64>, thread_pool: &ThreadPool, rng: impl Rng, pl: &mut impl ConcurrentProgressLog, ) -> Result<()>

Runs HyperBall.

§Arguments
  • upper_bound: an upper bound to the number of iterations.

  • threshold: a value that will be used to stop the computation by relative increment if the neighborhood function is being computed. If None the computation will stop when no estimators are modified.

  • thread_pool: The thread pool to use for parallel computation.

  • pl: A progress logger.

Source

pub fn run_until_stable( &mut self, upper_bound: usize, thread_pool: &ThreadPool, rng: impl Rng, pl: &mut impl ConcurrentProgressLog, ) -> Result<()>

Runs HyperBall until no estimators are modified.

§Arguments
  • upper_bound: an upper bound to the number of iterations.

  • thread_pool: The thread pool to use for parallel computation.

  • pl: A progress logger.

Source

pub fn run_until_done( &mut self, thread_pool: &ThreadPool, rng: impl Rng, pl: &mut impl ConcurrentProgressLog, ) -> Result<()>

Runs HyperBall until no estimators are modified with no upper bound on the number of iterations.

§Arguments
  • thread_pool: The thread pool to use for parallel computation.

  • pl: A progress logger.

Source

pub fn neighborhood_function(&self) -> Result<&[f64]>

Returns the neighborhood function computed by this instance.

Source

pub fn sum_of_distances(&self) -> Result<&[f32]>

Returns the sum of distances computed by this instance if requested.

Source

pub fn harmonic_centralities(&self) -> Result<&[f32]>

Returns the harmonic centralities (sum of inverse distances) computed by this instance if requested.

Source

pub fn discounted_centrality(&self, index: usize) -> Result<&[f32]>

Returns the discounted centralities of the specified index computed by this instance.

§Arguments
  • index: the index of the requested discounted centrality.
Source

pub fn closeness_centrality(&self) -> Result<Box<[f32]>>

Computes and returns the closeness centralities from the sum of distances computed by this instance.

Source

pub fn lin_centrality(&self) -> Result<Box<[f32]>>

Computes and returns the lin centralities from the sum of distances computed by this instance.

Note that lin’s index for isolated nodes is by (our) definition one (it’s smaller than any other node).

Source

pub fn nieminen_centrality(&self) -> Result<Box<[f32]>>

Computes and returns the Nieminen centralities from the sum of distances computed by this instance.

Source

pub fn reachable_nodes_from(&self, node: usize) -> Result<f64>

Reads from the internal estimator array and estimates the number of nodes reachable from the specified node.

§Arguments
  • node: the index of the node to compute reachable nodes from.
Source

pub fn reachable_nodes(&self) -> Result<Box<[f32]>>

Reads from the internal estimator array and estimates the number of nodes reachable from every node of the graph.

hyperball.reachable_nodes().unwrap()[i] is equal to hyperball.reachable_nodes_from(i).unwrap().

Auto Trait Implementations§

§

impl<'a, G1, G2, D, L, A> !Freeze for HyperBall<'a, G1, G2, D, L, A>

§

impl<'a, G1, G2, D, L, A> !RefUnwindSafe for HyperBall<'a, G1, G2, D, L, A>

§

impl<'a, G1, G2, D, L, A> !Send for HyperBall<'a, G1, G2, D, L, A>

§

impl<'a, G1, G2, D, L, A> Sync for HyperBall<'a, G1, G2, D, L, A>
where A: Sync, D: Sync,

§

impl<'a, G1, G2, D, L, A> Unpin for HyperBall<'a, G1, G2, D, L, A>
where A: Unpin, L: Unpin,

§

impl<'a, G1, G2, D, L, A> !UnwindSafe for HyperBall<'a, G1, G2, D, L, A>

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

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T> CastableFrom<T> for T

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
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> 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> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

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

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T> UpcastableFrom<T> for T

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

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

Source§

fn vzip(self) -> V