pub fn collect_vars(e: &Expr, out: &mut BTreeSet<usize>)Expand description
Walk e and insert every Var(i) index into out.
Shared Cse bodies are visited once per call, memoized on Arc pointer
identity. Without that this is Θ(2^depth) on a DAG that shares
subexpressions — each reference re-walks the whole body — and presolve
calls this on every solve (get_variables_linearity). Skipping a
repeat visit cannot change the answer: out is a set, and a second
walk of the same body inserts exactly the indices the first already did.