I am facing an issue in my research where I need to enumerate all combinations of an underlying set. BUT the set has some special features. Here is an example:(adsbygoogle = window.adsbygoogle || []).push({});

Given a set {A,B,C,D,E, F} where each item in the set consists of two values. Something like:

A = (1,2)

B = (3,4)

C = (5,6)

D = (1,6)

E = (3,5)

F = (1,3)

Now, my task is to generate (quickly) all combinations of the items in the set where you use the underlying numbers at most once. In the above example, the resulting subsets would be:

{A, B, C}

{A, E}

{B, D}

{C, B}

{D, B}

{D, E}

...and maybe a few others. But hopefully this illustrates what I mean. When starting this problem, I implemented a very inefficient (but complete) recursive algorithm that enumerated all combinations (including order) and just eliminated the duplicates. But this has proven to be untenable now that my set size is in the 30's and the underlying set of numbers is nearly 20.

I realize that this specific problem has maybe not been pursued in Comp Sci, and that it can be considered a special case of n choose m where order doesn't matter. So my question to you all would be, what is the most efficient n choose m algorithm out there (for unordered sets)? or even better, has my problem been solved by someone else already?

Thanks!

Brian

**Physics Forums - The Fusion of Science and Community**

# Enumerating Combinations

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

Have something to add?

- Similar discussions for: Enumerating Combinations

Loading...

**Physics Forums - The Fusion of Science and Community**