Skip to main content

collapse_sccs_with_progress

Function collapse_sccs_with_progress 

Source
pub fn collapse_sccs_with_progress<F>(
    graph: &SqliteGraph,
    progress: &F,
) -> Result<SccCollapseResult, SqliteGraphError>
Expand description

Collapses SCCs with progress tracking.

Same algorithm as collapse_sccs but reports progress during execution. Useful for long-running operations on large graphs.

§Arguments

  • graph - The graph to analyze
  • progress - Progress callback for reporting execution status

§Returns

SccCollapseResult containing the condensed graph and mappings.

§Progress Reporting

The callback receives:

  • current: Current number of edges processed
  • total: Total number of edges (if known)
  • message: Progress status message

Progress milestones:

  • After SCC computation: “SCC collapse: computed {count} SCCs”
  • During edge enumeration: Every ~100 edges processed
  • On completion: Calls on_complete()

§Example

use sqlitegraph::{algo::collapse_sccs_with_progress, progress::ConsoleProgress};

let progress = ConsoleProgress::new();
let collapsed = collapse_sccs_with_progress(&graph, &progress)?;
// Output:
// SCC collapse: computed 5 SCCs [0 edges processed]
// SCC collapse: building condensed graph... [100 edges processed]
// Complete