Skip to main content

pagerank_with_progress

Function pagerank_with_progress 

Source
pub fn pagerank_with_progress<F>(
    graph: &SqliteGraph,
    damping: f64,
    iterations: usize,
    progress: &F,
) -> Result<Vec<(i64, f64)>, SqliteGraphError>
Expand description

Computes PageRank scores with progress callback reporting.

This is the progress-reporting variant of pagerank. See that function for full algorithm documentation.

§Arguments

  • graph - The graph to analyze
  • damping - Damping factor (typically 0.85)
  • iterations - Number of power iteration iterations
  • progress - Callback for progress updates

§Progress Reporting

  • Reports progress at each iteration: “PageRank iteration X/Y”
  • Calls on_complete() when finished
  • Calls on_error() if an error occurs

§Example

use sqlitegraph::{SqliteGraph, algo::pagerank_with_progress};
use sqlitegraph::progress::NoProgress;

let graph = SqliteGraph::open_in_memory()?;
// ... add nodes and edges ...
let progress = NoProgress;
let scores = pagerank_with_progress(&graph, 0.85, 20, &progress)?;