# Find all pairs of disjoint subsets of list

Given a set $$E$$, how can I find all pairs of subsets $$E_1, E_2$$ which are non empty and disjoint? I don't care the order of $$E_1, E_2$$.

Right now I use a bit complicated code. First find all partitions, and the choose subsets from them.

partition[elist_] := Module[{lengthsAll},
lengthsAll =
Flatten[Permutations /@ IntegerPartitions[Length[elist]], 1];
FoldPairList[TakeDrop, elist, #] & /@ lengthsAll
]

e0e2[elist_] := Module[{part},
part = partition[elist] // Select[#, Length[#] >= 2 &] &;
part = Subsets[#, {2}] & /@ part // Flatten[#, 1] &
]


ClearAll[f]
f = Select[Apply[DisjointQ]] @ Subsets[Subsets[#, {1, ∞}], {2}] &;

f[{a, b, c}]

{{{a}, {b}}, {{a}, {c}}, {{a}, {b, c}}, {{b}, {c}}, {{b}, {a, c}}, {{c}, {a, b}}}


Note: This is not quite the same as the list produced by OP's e0e2:

Sort @ e0e2[{a, b, c}]

{{{a}, {b}}, {{a}, {c}}, {{a}, {b, c}}, {{b}, {c}}, {{a, b}, {c}}}

• I see, I made a mistake and missed one. – ablmf May 1 '20 at 9:38