Skip to main content

min_st_cut_with_progress

Function min_st_cut_with_progress 

Source
pub fn min_st_cut_with_progress<F>(
    graph: &SqliteGraph,
    source: i64,
    sink: i64,
    progress: &F,
) -> Result<MinCutResult, SqliteGraphError>
Expand description

Compute minimum s-t edge cut with progress tracking.

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

§Arguments

  • graph - The graph to analyze
  • source - The source node ID
  • sink - The sink (target) node ID
  • progress - Progress callback for reporting execution status

§Returns

MinCutResult containing source_side, sink_side, cut_edges, and cut_size.

§Progress Reporting

The callback receives:

  • current: Current BFS iteration
  • total: None (unknown total iterations for Edmonds-Karp)
  • message: “Min cut: iteration {current}, flow so far: {flow}”

Progress is reported after each augmenting path is found.

§Example

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

let progress = ConsoleProgress::new();
let result = min_st_cut_with_progress(&graph, 1, 5, &progress)?;
// Output: Min cut: iteration 1, flow so far: 1...
// Output: Min cut: iteration 2, flow so far: 2...