How to solve the Secret Santa Problem using graph theory
1–10 of 25 posts
Re: How to solve the Secret Santa Problem using graph theory
#2Re: How to solve the Secret Santa Problem using graph theory
#3What I don't understand is why it has to be a hamiltonian cycle. It could be simplified to just picking the set of edges in the directed graph that make every vertex have one incoming and one outgoing edge. The naive approach would be to assign sequentially from a set of available receivers, such as people passing around a hat and picking numbers from it without replacement, and not having the last picked participant…
This constrains the problem less but I don't think it allows a simpler algorithm. Your approach still needs some backtracking, if I understand right: what if Alice and Bob are the last two to be picked?
Re: How to solve the Secret Santa Problem using graph theory
#4Re: How to solve the Secret Santa Problem using graph theory
#5I have a feeling that this is not correct, but cannot determine why.
Re: How to solve the Secret Santa Problem using graph theory
#6Re: How to solve the Secret Santa Problem using graph theory
#7Re: How to solve the Secret Santa Problem using graph theory
#8In other news, at this past Secret Santa I got a desk-mounted boom for my Blue Yeti, which I use every day and am thankful for.
Re: How to solve the Secret Santa Problem using graph theory
#9Can't the Secret Santa problem be solved just by shuffling an array of participants, and assigning a person A[i] to give a gift to a person A[(i+1)%N]? I have a feeling that this is not correct, but cannot determine why.
Re: How to solve the Secret Santa Problem using graph theory
#10Can't the Secret Santa problem be solved just by shuffling an array of participants, and assigning a person A[i] to give a gift to a person A[(i+1)%N]? I have a feeling that this is not correct, but cannot determine why.