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>
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>
Sourcepub fn run(
&mut self,
upper_bound: usize,
threshold: Option<f64>,
thread_pool: &ThreadPool,
rng: impl Rng,
pl: &mut impl ConcurrentProgressLog,
) -> Result<()>
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. IfNone
the computation will stop when no estimators are modified. -
thread_pool
: The thread pool to use for parallel computation. -
pl
: A progress logger.
Sourcepub fn run_until_stable(
&mut self,
upper_bound: usize,
thread_pool: &ThreadPool,
rng: impl Rng,
pl: &mut impl ConcurrentProgressLog,
) -> Result<()>
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.
Sourcepub fn run_until_done(
&mut self,
thread_pool: &ThreadPool,
rng: impl Rng,
pl: &mut impl ConcurrentProgressLog,
) -> Result<()>
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.
Sourcepub fn neighborhood_function(&self) -> Result<&[f64]>
pub fn neighborhood_function(&self) -> Result<&[f64]>
Returns the neighborhood function computed by this instance.
Sourcepub fn sum_of_distances(&self) -> Result<&[f32]>
pub fn sum_of_distances(&self) -> Result<&[f32]>
Returns the sum of distances computed by this instance if requested.
Sourcepub fn harmonic_centralities(&self) -> Result<&[f32]>
pub fn harmonic_centralities(&self) -> Result<&[f32]>
Returns the harmonic centralities (sum of inverse distances) computed by this instance if requested.
Sourcepub fn discounted_centrality(&self, index: usize) -> Result<&[f32]>
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.
Sourcepub fn closeness_centrality(&self) -> Result<Box<[f32]>>
pub fn closeness_centrality(&self) -> Result<Box<[f32]>>
Computes and returns the closeness centralities from the sum of distances computed by this instance.
Sourcepub fn lin_centrality(&self) -> Result<Box<[f32]>>
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).
Sourcepub fn nieminen_centrality(&self) -> Result<Box<[f32]>>
pub fn nieminen_centrality(&self) -> Result<Box<[f32]>>
Computes and returns the Nieminen centralities from the sum of distances computed by this instance.
Sourcepub fn reachable_nodes_from(&self, node: usize) -> Result<f64>
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.
Sourcepub fn reachable_nodes(&self) -> Result<Box<[f32]>>
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>
impl<'a, G1, G2, D, L, A> Unpin for HyperBall<'a, G1, G2, D, L, A>
impl<'a, G1, G2, D, L, A> !UnwindSafe for HyperBall<'a, G1, G2, D, L, A>
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, 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> 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, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
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