This is not a solution, as it is another way to think about a problem.
Make the following chart:
- Vertices are all subsets of
S sizes n or n+1 . - There is an edge between
v and w if two sets differ by one element.
For example, for n = 1 you get the following loop:
{1} --- {1,3} --- {3} | | | | {1,2} --- {2} --- {2,3}
Your problem is to find the Hamiltonian cycle :
A Hamiltonian cycle (or Hamiltonian scheme) is a cycle into an undirected graph that visits each vertex exactly once, and also returns to the starting vertex. Determining whether such paths and cycles in graphs is a Hamiltonian trajectory problem that is NP-complete.
In other words, this problem is complex.
There are several theorems that give sufficient conditions for the existence of a Hamiltonian cycle in a graph (for example, if all vertices have degree at least N/2 , where n is the number of vertices), but none of them knows right away that this graph has a Hamiltonian cycle.
You can try one of the countless algorithms to determine if a Hamiltonian cycle exists. For example, from a wikipedia article to Hamilton's Path Problem :
A trivial heuristic algorithm for finding Hamiltonian paths is to build the path abc ... and expand it until it becomes impossible; when the path abc ... xyz cannot be expanded anymore, because all neighbors of z are already on the path, one returns one step, removing the edge yz and the path with the other neighbor of y; if none of the options creates a Hamiltonian trajectory, then take a step backward, removing the edge xy and expanding the path using another neighbor x, etc. This algorithm will certainly find the Hamiltonian path (if any), but it works exponentially.
Hope this helps.
Good news . Although the problem with the Hamiltonian cycle is complex in general, this graph is very good: it is bipartite and (n+1) -regular. This means that there may be a pleasant solution for this particular schedule.
Bad news . After a short search, it turned out that this problem is known as a mid-level hypothesis, and it seems that it arose around 1980. As far as I can tell, the problem is still open at all, but it was checked by the computer for n <= 17 (and I found the preprint from 12/2009, requiring confirmation of n=18 ). These two pages contain additional information about the problem and links: