Algorithms for structural learning with decompositions