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 withresidual[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: f64Teleportation probability (alpha).
epsilon: f64Approximation tolerance (epsilon).
Implementations§
Source§impl ForwardPushSolver
impl ForwardPushSolver
Sourcepub fn new(alpha: f64, epsilon: f64) -> Self
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).
Sourcepub fn default_params() -> Self
pub fn default_params() -> Self
Create a solver with default parameters (alpha = 0.85,
epsilon = 1e-6).
Sourcepub fn ppr_from_source(
&self,
graph: &CsrMatrix<f64>,
source: usize,
) -> Result<Vec<(usize, f64)>, SolverError>
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
SolverError::InvalidInputifsource >= graph.rows.SolverError::NumericalInstabilityif the mass invariant is violated after convergence.
Trait Implementations§
Source§impl Clone for ForwardPushSolver
impl Clone for ForwardPushSolver
Source§fn clone(&self) -> ForwardPushSolver
fn clone(&self) -> ForwardPushSolver
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ForwardPushSolver
impl Debug for ForwardPushSolver
Source§impl SolverEngine for ForwardPushSolver
impl SolverEngine for ForwardPushSolver
Source§fn solve(
&self,
matrix: &CsrMatrix<f64>,
rhs: &[f64],
_budget: &ComputeBudget,
) -> Result<SolverResult, SolverError>
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.