I have a set of elements A = {a, b, c, d, e, f}
I want to get all sets of disjoint sets of any size that cover A. So {{{a,b}, {c,d,e,f}}, {{a,b}{c,d,e}{f}}, {{a,b,c}{d,e,f}}...}
, etc.
Is there an easy (not too slow) way of doing this? Ideally in python, but the general algorithm would also be appreciated.
I tried getting the power-set of the power-set to then filter out the sets with disjoint sets, but that blows up too quickly and kills my computer.
The purpose is to find all possible subtrees in a tree make make up that tree again.