I'm searching for an algorithm that forms a balanced (or quasi-complete) latin square, in which every element is a horizontal neighbor to every other element exactly twice, and a vertical neighbor to every other element exactly twice.
I've found one example (for n = 5), but am not clear about a couple of steps:
Step 1: Write 1 2 ... n as the first row
Step 2: For i even in the first row, fill in the diagonal from upper left to lower right starting with i and alternating with i - 1
12345 1 3 2 1
Step 3: For i odd and less than n in the first row fill in the diagonal from upper right to lower left beginning with i and alternating with i + 1
12345 41 3 3 2 1
Step 4: Fill in n for the main off diagonal
12345 4153 3 52 5 1 5
Step 5: For the last column write n n-2 n-1 n-3 ... 1 2
12345 4153 3 524 5 1 5 2
Step 6: For the even entries of the last column, fill in the diagonal from upper left to lower right beginning with i and alternating with i - 1
Step 7: Complete by symmetry about the main diagonal
For n = 5, the following is obtained:
12345 24153 31524 45231 53412
[RE: Step 5] I was able to fill in that portion of the square, but am not sure what would come after n-3 in a larger sequence, as it would go n n-2 n-1 n-3 ??? ... 1 2
[RE: Step 6] Are even entries even numbers, or does that refer to even positions in the column? Is "i" in this case the number at the upper left or is it the even entry? I don't see how the completed square corresponds to the instructions in this step.
[RE: Step 7] What does "complete by symmetry about the main diagonal" mean?
Otherwise if there's a less involved algorithm for balancing a latin square, I'd like to know how it goes.