Skip to main content

SublinearPageRank

Trait SublinearPageRank 

Source
pub trait SublinearPageRank: Send + Sync {
    // Required methods
    fn ppr(
        &self,
        matrix: &CsrMatrix<f64>,
        source: usize,
        alpha: f64,
        epsilon: f64,
    ) -> Result<Vec<(usize, f64)>, SolverError>;
    fn ppr_multi_seed(
        &self,
        matrix: &CsrMatrix<f64>,
        seeds: &[(usize, f64)],
        alpha: f64,
        epsilon: f64,
    ) -> Result<Vec<(usize, f64)>, SolverError>;
}
Expand description

Trait for sublinear-time Personalized PageRank (PPR) algorithms.

PPR is central to nearest-neighbour search in large graphs. Algorithms implementing this trait run in time proportional to the output size rather than the full graph size.

Required Methods§

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.

§Arguments
  • matrix - column-stochastic transition matrix (or CSR adjacency).
  • source - index of the source (seed) node.
  • alpha - teleportation probability (typically 0.15).
  • epsilon - approximation tolerance; controls output sparsity.
§Returns

A vector of (node_index, ppr_value) pairs whose values sum to approximately 1.

§Errors

Returns SolverError on invalid input or budget exhaustion.

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.

§Arguments
  • matrix - column-stochastic transition matrix.
  • seeds - (node_index, weight) pairs forming the seed distribution.
  • alpha - teleportation probability.
  • epsilon - approximation tolerance.
§Errors

Returns SolverError on invalid input or budget exhaustion.

Implementors§