I have a combinations with 3 factors:
{a1,m1,c1}
{a1,m1,c2}
{a1,m2,c1}
{a2,m1,c1}
{a2,m1,c2}
Now I want to "compress" these 5 expressions into as few expressions as possible, in this case 2 is the minimum:
{{c1,c2},{m1},{a1,a2}}
{{c1},{m2},{a1}}
As we can see, we can easily generate original combinations from the compressed expressions.
My question is how do I generalize an algorithm to compress the combinations to fewest expressions?
I have more complex case with 4 or 5 factors.
I believe there is an existing algorithm for doing this, could you share a link to the algorithm?
Update:
A more general case with 2 factors:
Using
{a1,a2,a3} {c1,c2,c3}
we can generate
{a1,c1} {a1,c2} {a1,c3}, {a2,c1} {a2,c2} {a2,c3} {a3,c1} {a3,c2} {a3,c3}
How can I deduce
{{a1,a2,a3},{c1,c2,c3}}
from
{a1,c1} {a1,c2} {a1,c3}, {a2,c1} {a2,c2} {a2,c3} {a3,c1} {a3,c2} {a3,c3}
Tuples[{{a1, a2}, {m1}, {c1, c2}}]
andTuples[{{a1},{m2},{c1}}]
with as small a generating set as possible (two in this case)? $\endgroup$ – march Apr 9 '19 at 17:15result
of the algorithm is meant to be the "inverse" ofUnion @@ (Tuples /@ result)
? $\endgroup$ – Henrik Schumacher Apr 9 '19 at 17:20