Skip to main content

ForwardPushSolver

Struct ForwardPushSolver 

Source
pub struct ForwardPushSolver {
    pub alpha: f64,
    pub epsilon: f64,
}
Expand description

Forward Push solver for Personalized PageRank.

Given a graph encoded as a CsrMatrix<f64> (adjacency list in CSR format), computes the PPR vector from a single source vertex.

§Parameters

  • alpha – teleport probability (fraction absorbed per push). Default: 0.85.
  • epsilon – push threshold. Vertices with residual[u] > epsilon * degree(u) are eligible for a push. Smaller values yield more accurate results at the cost of more work.

§Complexity

O(1 / epsilon) pushes in total, independent of |V| or |E|.

Fields§

§alpha: f64

Teleportation probability (alpha).

§epsilon: f64

Approximation tolerance (epsilon).

Implementations§

Source§

impl ForwardPushSolver

Source

pub fn new(alpha: f64, epsilon: f64) -> Self

Create a new forward-push solver.

Parameters are validated lazily at the start of each computation (see validate_params).

Source

pub fn default_params() -> Self

Create a solver with default parameters (alpha = 0.85, epsilon = 1e-6).

Source

pub fn ppr_from_source( &self, graph: &CsrMatrix<f64>, source: usize, ) -> Result<Vec<(usize, f64)>, SolverError>

Compute PPR from source returning sparse (vertex, score) pairs sorted by score descending.

§Errors
Source

pub fn top_k( &self, graph: &CsrMatrix<f64>, source: usize, k: usize, ) -> Result<Vec<(usize, f64)>, SolverError>

Compute PPR from source and return only the top-k entries.

Convenience wrapper around ppr_from_source.

Trait Implementations§

Source§

impl Clone for ForwardPushSolver

Source§

fn clone(&self) -> ForwardPushSolver

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 Debug for ForwardPushSolver

Source§

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

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

impl SolverEngine for ForwardPushSolver

Source§

fn solve( &self, matrix: &CsrMatrix<f64>, rhs: &[f64], _budget: &ComputeBudget, ) -> Result<SolverResult, SolverError>

Adapt forward-push PPR to the generic solver interface.

The rhs vector is interpreted as a source indicator: the index of the first non-zero entry is taken as the source vertex. If rhs is all zeros, vertex 0 is used. The returned SolverResult.solution contains the dense PPR vector.

Source§

fn estimate_complexity( &self, _profile: &SparsityProfile, _n: usize, ) -> ComplexityEstimate

Estimate the computational cost of solving the given system without actually performing the solve. Read more
Source§

fn algorithm(&self) -> Algorithm

Return the algorithm identifier for this engine.
Source§

impl SublinearPageRank for ForwardPushSolver

Source§

fn ppr( &self, matrix: &CsrMatrix<f64>, source: usize, alpha: f64, epsilon: f64, ) -> Result<Vec<(usize, f64)>, SolverError>

Compute a sparse approximate PPR vector from a single source node. Read more
Source§

fn ppr_multi_seed( &self, matrix: &CsrMatrix<f64>, seeds: &[(usize, f64)], alpha: f64, epsilon: f64, ) -> Result<Vec<(usize, f64)>, SolverError>

Compute PPR from a distribution over seed nodes rather than a single source. Read more

Auto Trait Implementations§

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