pub struct PageRankConfig {
pub damping_factor: f64,
pub max_iterations: usize,
pub tolerance: f64,
pub normalize: bool,
pub max_graph_nodes: Option<usize>,
}Expand description
Configuration for PageRank algorithm.
Fields§
§damping_factor: f64Damping factor (probability of following a link vs random jump). Default: 0.85
max_iterations: usizeMaximum number of iterations before stopping. Default: 100
tolerance: f64Convergence tolerance. Algorithm stops when max score change < tolerance. Default: 1e-6
normalize: boolWhether to normalize scores to sum to 1.0. Default: true
max_graph_nodes: Option<usize>Maximum number of nodes allowed before returning an error.
Set to None to disable the check.
Default: 10,000,000 (10M nodes)
Implementations§
Source§impl PageRankConfig
impl PageRankConfig
Sourcepub const fn with_damping_factor(self, damping_factor: f64) -> Self
pub const fn with_damping_factor(self, damping_factor: f64) -> Self
Set the damping factor.
The damping factor represents the probability that a random walker follows a link instead of jumping to a random node. Common values are 0.85 (default) or 0.9.
Sourcepub const fn with_max_iterations(self, max_iterations: usize) -> Self
pub const fn with_max_iterations(self, max_iterations: usize) -> Self
Set the maximum number of iterations.
Sourcepub const fn with_tolerance(self, tolerance: f64) -> Self
pub const fn with_tolerance(self, tolerance: f64) -> Self
Set the convergence tolerance.
The algorithm stops when the maximum change in any node’s score between iterations is less than this value.
Sourcepub const fn with_normalize(self, normalize: bool) -> Self
pub const fn with_normalize(self, normalize: bool) -> Self
Set whether to normalize scores to sum to 1.0.
Sourcepub const fn with_max_graph_nodes(self, limit: Option<usize>) -> Self
pub const fn with_max_graph_nodes(self, limit: Option<usize>) -> Self
Set the maximum number of nodes allowed.
If the graph has more nodes than this limit, the algorithm will
return a GraphError::GraphTooLarge error instead of attempting
to allocate potentially gigabytes of memory.
Set to None to disable the check (use with caution).
Trait Implementations§
Source§impl Clone for PageRankConfig
impl Clone for PageRankConfig
Source§fn clone(&self) -> PageRankConfig
fn clone(&self) -> PageRankConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more