I have the following lists:
l1 = {{a,b},{a,c},{a,d},{a,e},{a,f}};
l2 = {{b,c},{b,d},{b,e},{b,f}};
l3 = {{c,d},{c,e},{c,f}};
l4 = {{d,e},{d,f}};
l5 = {e,f};
I want to create a list of combinations of exactly three of the above sublists, with no repeating elemenst. It should look like:
L = {{{a,b},{c,d},{e,f}},{{a,b},{c,e},{d,f}},...,{{{a,c},{b,d},{e,f}}...};
For example, for four lists $l$ with elements {a,b,c,d}, the final list should look like this:
L = {{{a,b},{c,d}},{{a,c},{b,d}},{{a,d},{b,c}}};
For five lists $l$, the dimensions should be {15,3,2}, but I want to generalize this for more lists $l$. As the dimension of $L$ grows as $n!!$, I'm trying to write a general code.
Is there an easy way to do this? Thank you!
EDIT
As chyanog pointed out in the comments, this question has been answered here. The following function posted by Rojo gives a general list $L$ of dimensions $\{n!!,\frac{n}{2},l\}$:
partitions[list_, l_] := Join @@
Table[
{x, ##} & @@@ partitions[list ~Complement~ x, l],
{x, Subsets[list, {l}, Binomial[Length[list] - 1, l - 1]]}
]
partitions[list_, l_] /; Length[list] === l := {{list}}
, and to get the lists I'm looking for, $l=2$.