(The question is an extension of this unanswered question on stackoverflow)
If we have a set of strings, we can efficiently represent them with tries. Common branches can also be merged, resulting in a DAG instead of a tree that is even more compact.
However, if we have a set of sets (i.e. the order does not matter), there are a lot of possible tries that represent the same set of elements. An example can be found in the stackoverflow question I linked above.
Edit: For example, assume that we are given the following sets of integers.
{1,2,3,4,5}
{1,2,6,7}
{1,2,4,7}
{1,3,5,7}
Two possible representations are shown below (trie on the left, DAG on the right)
My questions are:
- How hard is the problem of finding an optimal (i.e minimal) such trie?
- Are there any fast algorithms for solving this problem?
- If not, are there any fast algorithms that find "good" tries?
- What about the DAG case?
In the scenario I have in mind there is an additional constraint that no set is a subset of another set.
Any link/paper that is even slightly relevant to any of the questions is helpful.