# Trying to find all unique pairing of a list

Hello all,

I have a list of 12 numbers 1-12. Im trying to make pairs from the list so for example:

1+2
3+4
5+6
7+8
9+10
11+12

This would one set. Im trying to find all the unique sets possible (and visibly show the match ups in a grasshopper panel - I dont need to know the mathematical total of unique sets as a list length).

Likewise, the order of pairs within the set does not matter. For example:

2+1
3+4
5+6
7+8
9+10
11+12

or

3+4
5+6
1+2
7+8
9+10
11+12

Neither of these sets would count as novel sets: they would both be identical to the first example. For this problem, 1 has been paired with 2 already. It doesnt make it a new set to change the order of the pair or change the pairâ€™s order in the set.

Is there a way to output a list of all the unique sets possible?

Thanks you,

B

I guess youâ€™re looking for Cross Reference component.

CrossReference.gh (16.6 KB)

Kind of, but the end result needs to be as sets of 6 distinct pairs not just as a list of all the total unique pairs.

A set is all 12 numbers, paired.

How would I take those unique pairs and make as many unique sets (a set is all 12 numbers as 6 pairs) available? Reference above is one example showing a set.

The explanation is confusing, is there a way, you can provide an example of sorts with the desired result.
Best,
Mr A.

Think of it this way. You have a group of 12 people. You want all 12 to simultaneously meet in pairs. After the first meeting you want to have another meeting, so you mix up the pairings so no single participant speaks with the same person they have already spoken with. For the third meeting you mix it up again, so each person again talks to someone new, and so on. I want to find all possible sets of 6 pairs where no one individual ever speaks with someone they have spoken with before.

Ill define the terms again:

There is a list of 12 numbers.
A â€śpairâ€ť is a group of 2 of the 12 numbers together.
A â€śsetâ€ť is a group of all 6 pairs together.

So a pair could be: 1+2, 5+11, 12+3 etc. Mahdiyarâ€™s definition shows all the possible permutations possible here.

BUT

The end goal is not to simply find pairs, its to find distinct SETS. So, as in the first post,
1+2
3+4
5+6
7+8
9+10
11+12

is one novel set.

However:

2+1
3+4
5+6
7+8
9+10
11+12

or

3+4
5+6
1+2
7+8
9+10
11+12

are both examples of repeated sets identical to the first. The difference in order doesnt make either count as a novel set.

Hello,

This sounds like a combinatorial problem. If you can find the standard name of this problem then it should be easy to find a python implementation. You can then solve it with a python component.

Sorry I canâ€™t give you a full solutionâ€¦

-Graham