Crate rusty_santa [−] [src]
A small Rust library (and command-line tool) for resolving Secret Santa assignments with additional constraints.
It is possible to add the following constraints to the random assignments:
- Person A and B should not draw each other (e.g. for couples)
- Person A should not draw person B (e.g. if person B already received a gift from person A the previous year, or if person A dislikes person B)
While this is an interesting mathematical problem and can be solved with bipartite graphs and the hungarian algorithm, this library sticks to a simpler approach and tries to emulate the real name drawing from a basket. Up to 1000 attempts are made at resolving the name assignments without conflict until the algorithm fails.
A group of people that wants to draw names.
Errors that can happen while assigning names.