Report progress after completing an iteration. `convergence_delta`: the convergence metric for this iteration (e.g., L1 norm of rank change for PageRank). Pass `None` for non-convergence-tracked algorithms.
(&mut self, iteration: usize, convergence_delta: Option<f64>)
| 88 | /// (e.g., L1 norm of rank change for PageRank). Pass `None` for |
| 89 | /// non-convergence-tracked algorithms. |
| 90 | pub fn report_iteration(&mut self, iteration: usize, convergence_delta: Option<f64>) { |
| 91 | self.last_delta = convergence_delta; |
| 92 | let elapsed_ms = self.start.elapsed().as_millis() as u64; |
| 93 | let converged = match (convergence_delta, self.tolerance) { |
| 94 | (Some(delta), Some(tol)) => delta < tol, |
| 95 | _ => false, |
| 96 | }; |
| 97 | |
| 98 | tracing::debug!( |
| 99 | algorithm = self.algorithm.name(), |
| 100 | iteration, |
| 101 | max_iterations = self.max_iterations, |
| 102 | convergence_delta = convergence_delta.unwrap_or(0.0), |
| 103 | elapsed_ms, |
| 104 | converged, |
| 105 | "graph algorithm iteration" |
| 106 | ); |
| 107 | } |
| 108 | |
| 109 | /// Build a progress snapshot for the current state. |
| 110 | pub fn snapshot(&self, iteration: usize) -> AlgoProgress { |