Skip to main content

pagerank

Function pagerank 

Source
pub fn pagerank(
    graph: &dyn GraphBackend,
    damping: f64,
    iterations: usize,
) -> Result<Vec<(i64, f64)>, SqliteGraphError>
Expand description

Computes PageRank scores for all nodes in the graph.

Backend-agnostic version that works with any GraphBackend implementation. Uses only entity_ids() and fetch_outgoing() trait methods.

§Arguments

  • graph - Any backend implementing GraphBackend trait
  • damping - Damping factor (typically 0.85)
  • iterations - Number of power iteration iterations

§Returns

Vector of (node_id, score) tuples sorted by score descending.

§Complexity

Time: O(k * |E|) where k = iterations Space: O(|V|) for score storage