Skip to main content

critical_path_with_progress

Function critical_path_with_progress 

Source
pub fn critical_path_with_progress<F>(
    graph: &SqliteGraph,
    weight_fn: &WeightCallback,
    progress: &F,
) -> Result<CriticalPathResult, CriticalPathError>
Expand description

Computes the critical path with progress tracking.

Same as critical_path but reports progress during execution. Suitable for long-running critical path analysis on large graphs.

§Progress Stages

  1. “Validating DAG structure” - Topological sort
  2. “Computing critical path” - Longest path DP
  3. “Reconstructing path” - Building the path from predecessors

§Arguments

  • graph - The DAG to analyze
  • weight_fn - Callback to extract edge weight
  • progress - Progress callback for status updates

§Example

use sqlitegraph::{
    SqliteGraph,
    algo::critical_path::{critical_path_with_progress, default_weight_fn},
    progress::ConsoleProgress
};

let graph = SqliteGraph::open_in_memory()?;
// ... build large DAG ...

let progress = ConsoleProgress::new();
let result = critical_path_with_progress(&graph, &default_weight_fn, &progress)?;