# Interesting "Tuples" application

{a,b},{c,d},{e,f}


and end up with:

{a,c,e},{a,c,f},{a,d,e},{a,d,f},{b,c,e},{b,c,f},{b,d,e},{b,d,f}


then do every ordering of each:

{a,c,e},{a,e,c},{c,a,e},{c,e,a},{e,a,c},{e,c,a},{a,c,f},{a,f,c},etc.


I believe Tuples combined with Permutations maybe are the way to go, but unsure how to do this.

• Not as elegant as your own solution, but also Outer[Permutations[{##}]&, Sequence@@set]//Catenate//Catenate Jun 2, 2021 at 11:04

Figured it out. Was easier than I thought:

set={{a,b},{c,d},{e,f}};
set2=Map[Permutations,Tuples[set]]

{{{a,c,e},{a,e,c},{c,a,e},{c,e,a},{e,a,c},{e,c,a}},
{{a,c,f},{a,f,c},{c,a,f},{c,f,a},{f,a,c},{f,c,a}},
{{a,d,e},{a,e,d},{d,a,e},{d,e,a},{e,a,d},{e,d,a}},
{{a,d,f},{a,f,d},{d,a,f},{d,f,a},{f,a,d},{f,d,a}},
{{b,c,e},{b,e,c},{c,b,e},{c,e,b},{e,b,c},{e,c,b}},
{{b,c,f},{b,f,c},{c,b,f},{c,f,b},{f,b,c},{f,c,b}},
{{b,d,e},{b,e,d},{d,b,e},{d,e,b},{e,b,d},{e,d,b}},
{{b,d,f},{b,f,d},{d,b,f},{d,f,b},{f,b,d},{f,d,b}}}

set3 = GroupOrbits[SymmetricGroup @ 3, Tuples @ set, Permute];

set4 = Distribute[set, List, List, List, Permutations @* List];


Both give the same output as OP's set2:

set3 == set4 == set2

True