pub fn reverse_reachable_from_with_progress<F>(
graph: &SqliteGraph,
target: i64,
progress: &F,
) -> Result<AHashSet<i64>, SqliteGraphError>where
F: ProgressCallback,Expand description
Computes backward reachability with progress tracking.
Same algorithm as reverse_reachable_from but reports progress during execution.
Useful for long-running operations on large graphs.
§Arguments
graph- The graph to analyzetarget- The target node IDprogress- Progress callback for reporting execution status
§Returns
Set of all node IDs that can reach target (including target itself).
§Progress Reporting
The callback receives:
current: Current number of nodes visitedtotal: None (unknown total for single-target BFS)message: “Backward reachability: visited {current}”
Progress is reported periodically (every ~10 nodes visited) to avoid excessive callback overhead while still providing feedback.
§Example
ⓘ
use sqlitegraph::{
algo::reverse_reachable_from_with_progress,
progress::ConsoleProgress
};
let progress = ConsoleProgress::new();
let ancestors = reverse_reachable_from_with_progress(&graph, target, &progress)?;
// Output: Backward reachability: visited 10...
// Output: Backward reachability: visited 20...