Partitioning a list
Sibylle Koczian
nulla.epistola at web.de
Thu Aug 23 10:30:22 EDT 2018
Am 21.08.2018 um 23:36 schrieb Poul Riis:
> I would like to list all possible ways to put N students in groups of k students (suppose that k divides N) with the restriction that no two students should ever meet each other in more than one group.
> I think this is a classical problem and I think there must be a python solution out there but I cannot find it. For instance, numpy's array_split only lists one (trivial) split.
> I would be happy if someone could refer me to a general python algorithm solving the problem.
>
This is indeed a classic (or rather the generalization of a classic):
Kirkman's Schoolgirl Problem (for N = 15), first published 1850.
I didn't find a Python solution, but the Wikipedia entry and a MathWorld
page, both with more links:
https://en.wikipedia.org/wiki/Kirkman%27s_schoolgirl_problem
http://mathworld.wolfram.com/KirkmansSchoolgirlProblem.html
HTH
Sibylle
More information about the Python-list
mailing list