I have collection $U$ of sets, where each set is of size at most 95 (corresponding to each printable ASCII character). For example, $\{h,r,l,a\}$ is one set, and $U = \{\{h,r,l,a\}, \{l,e,d\}, \ldots\}$. The number of sets in $U$ is nearly a million. Also a set in $U$ will mostly contains 8-20 elements.
I am looking for a datastructure for storing collection of sets that support following operations:
- set matching, e.g. check if set $\{h,r,l,a\}$ is present in $U$
- subset matching e.g. check if set $\{h,r,l\}$ is subset of any set in $U$
- superset matching e.g. check if set $\{h,r,l,a,s\}$ is superset of any set in $U$
- union matching e.g. check if set $\{h,r,l,a,e,d\}$ is union of sets in $U$
- approximate set matching e.g. check if set $\{h,r,l,e\}$ is present in $U$, should return true
In particular, we can assume that once the data structure is built, no modifications are made but only queries of the above type (the structure is static).
I was thinking of trie data structure. But, it demands storing data in some order. So I have to store every set as a bit vector, but then the trie becomes binary decision tree. Am I in the right direction? Any pointers will be appreciated.