Reputation: 21
Basically a problem I've been thinking about for the past couple weeks...
Initially thought of making each set in the list a node in a graph, and connecting nodes which do not have any common elements. I'd run a Hamilton path algorithm that only moves to the next node if the last k nodes don't contain a common element, however this seems really, really slow due to the nature of the Hamilton path algorithm. Would anyone else have any better ideas?
The restrictions for the variables is that each set can have around 1-40 elements, and the number of sets in the list would up to 40 maximum.
Upvotes: 2
Views: 50