use std::collections::HashMap; use std::cmp::PartialOrd; use std::hash::Hash; trait ParametricAPI { fn distance(&self, ratio: Ratio, edge: &Edge) -> Ratio; fn zero_cancel(&self, cycle: &Cycle) -> Ratio; } struct MaxParametricSolver { ncf: NegCycleFinder, omega: ParametricAPI, } impl MaxParametricSolver { fn run(&self, dist: &mut HashMap, ratio: Ratio) -> (Ratio, Cycle) { // Implementation here } } fn set_default(digraph: &mut GraphMut, weight: &str, value: Domain) { // Implementation here } struct CycleRatioAPI { digraph: HashMap>>, result_type: D, } impl CycleRatioAPI { fn distance(&self, ratio: Ratio, edge: &mut HashMap) -> Ratio { // Implementation here } fn zero_cancel(&self, cycle: &Cycle) -> Ratio { // Implementation here } } struct MinCycleRatioSolver { digraph: Graph, } impl MinCycleRatioSolver { fn run(&self, dist: &mut HashMap, r0: Ratio) -> (Ratio, Cycle) { // Implementation here } } fn test_cycle_ratio_raw() { // Test implementation here } fn test_cycle_ratio() { // Test implementation here } fn test_cycle_ratio_timing() { // Test implementation here } fn test_cycle_ratio_tiny_graph() { // Test implementation here }