use crate::opt::cost::FusionCost;
use crate::opt::lang::MathLang;
use egg::{EGraph, Extractor, Id, RecExpr};

pub fn extract_best(egraph: &EGraph<MathLang, ()>, root: Id) -> (usize, RecExpr<MathLang>) {
    let extractor = Extractor::new(egraph, FusionCost);
    extractor.find_best(root)
}
