Add algebraic optimization support for AIG and XAG networks
Add algebraic optimization support for AIG and XAG networks: a task in LegoFlow-SWE (Harbor dataset). Add a function aig balance that rewrites AND trees in an AIG network to reduce depth while preserving Boolean functionality. The behavior should be configurable via aig balancing params .
The task
Add a function `aig_balance` that rewrites AND trees in an AIG network to reduce depth while preserving Boolean functionality. The behavior should be configurable via `aig_balancing_params`.
Part of Lego-X/LegoFlow-SWE.