MichaelPe
Screenwriter
- Joined
- Feb 22, 1999
- Messages
- 1,115
I'm trying to get some more information about a problem I'm trying to solve, and I figured that this would be the best place to ask.
Basically, assume that we have N people and we would like them to pair up and talk for a few minutes. After a few minutes, I'd like them to swap partners and talk with someone new. And, this cycle continues until everyone has talked with everyone else, never speaking to the same person twice.
So, let's take the case of 6 people:
Round 1: (1,2) (3,4) (5,6)
Round 2: (1,3) (2,5) (4,6)
Round 3: (1,4) (2,6) (3,5)
Round 4: (1,5) (2,4) (3,6)
Round 5: (1,6) (2,3) (4,5)
In 5 rounds, everyone has had the chance to talk with everyone exactly once.
I solved the previous example by hand (trial-and-error), but I'm wondering if there is an algorithm to solve this problem for the general case of N people. I understand that the number of people must be even for this to work, and that we must evaluate each pairwise permutation (N-choose-2). Also, for this to work optimally, the total number of pairwise permutations must be perfectly divisible by the number of pairs at a time (N/2). In other words, the above case of 6 people worked out because there were 15 pairwise permutations and 3 pairs at a time, hence 5 rounds.
This should work for other values, such as 8, 10, 12, 14, 16: yielding 7, 9, 11, 13, 15 rounds respectively. So, does this algorithm exist? Does it have a name?
Thanks in advance!
Basically, assume that we have N people and we would like them to pair up and talk for a few minutes. After a few minutes, I'd like them to swap partners and talk with someone new. And, this cycle continues until everyone has talked with everyone else, never speaking to the same person twice.
So, let's take the case of 6 people:
Round 1: (1,2) (3,4) (5,6)
Round 2: (1,3) (2,5) (4,6)
Round 3: (1,4) (2,6) (3,5)
Round 4: (1,5) (2,4) (3,6)
Round 5: (1,6) (2,3) (4,5)
In 5 rounds, everyone has had the chance to talk with everyone exactly once.
I solved the previous example by hand (trial-and-error), but I'm wondering if there is an algorithm to solve this problem for the general case of N people. I understand that the number of people must be even for this to work, and that we must evaluate each pairwise permutation (N-choose-2). Also, for this to work optimally, the total number of pairwise permutations must be perfectly divisible by the number of pairs at a time (N/2). In other words, the above case of 6 people worked out because there were 15 pairwise permutations and 3 pairs at a time, hence 5 rounds.
This should work for other values, such as 8, 10, 12, 14, 16: yielding 7, 9, 11, 13, 15 rounds respectively. So, does this algorithm exist? Does it have a name?
Thanks in advance!