Tree-size reduction by collapsing nodes