# How to maximize 3-cycles in this graph type inspired by block design?

I've come up with this question and I've been playing with it for a couple weeks by now without any definite breakthrough; it seems there should be a better approach than straight naive brute force, but I haven't come up with anything conclusive yet. (The work and partial answers I have come up with, I am posting in a self-answer so as not to clutter the question.)

If you're not familiar with block design as mentioned in the title, then this Stack Overflow discussion of the game "Spot It!" is a good place to look for immediate familiarization. It's not strictly necessary to know for purposes of this question, but may be interesting for its own sake.

Consider a directed graph with 13 vertices and 52 edges, where each vertex has in-degree 4 and out-degree 4, and the edges are defined in a particular way as described below. (I'll call the vertices by uppercase letters A through M.)

In the following list, each row represents four edges; for example, the row "ABCD" represents that there are directed edges (A,B), (B,C), (C,D), (D,A).

ABCD
AEFG
AHIJ
AKLM
BEHK
BFIL
BGJM
CEIM
CFJK
CGHL
DEJL
DFHM
DGIK


(Notice that each row in the above list shares one letter and only one letter with each other row in the list. This is the connection to block design.)

The target is to maximize the number of 3-cycles (cycles of length 3) without disturbing the graph's relationship to block design.

The sequence of the four letters on each line may be changed arbitrarily to specify another similar graph, without disturbing the property that each row shares one and only one letter with each other row.

(Also note that as the vertex ending each row in the list connects to the vertex at the beginning of the row, there are 6 possible permutations per row, not 24; that is, ABCD and BCDA would be equivalent as they represent the same four edges.)

Now, the particular graph specified above has only 4 cycles of length 3; namely:

DAK
GAB
JAE
MAH


(Where DAK is shorthand for D->A, A->K, K->D.)

Here is the puzzle:

By permuting each row in the manner described, what is the maximum number of cycles of length 3 that can be achieved in the resulting graph?

• It looks like this question created the tag block-design. Just an FYI, there is also the tag [combinatorial-designs]; do you think these two are sufficiently different to warrant both? Or should one subsume the other/should a synonym be created? (I'm interested in designs but I don't know much; just an honest question) Jul 14 '17 at 10:50
• @pjs36 I'd have to look into combinatorial designs to be certain, but that sounds a fairly general term. Block design is a highly precise term; see the Wikipedia article. I made the new tag deliberately, if that counts for anything, after being startled it didn't exist. Jul 14 '17 at 10:54
• A Meta discussion has just started around the tag block-design, you might be interested in weighing in. Mar 30 '18 at 23:46

The first question is of course whether the number of cycles can be changed at all, or is it an invariant within the rules? A single example suffices to show that the 3-cycle count is not an invariant; to that end, I'll point out that permuting the cycle BGJM to BJMG while leaving all other rows as they are adds SEVEN 3-cycles to the graph while removing only GAB from the 3-cycles already present, for a net gain of 6. The cycles added are:

BJA
BJK
BJL
MGH
MGI
GBC
GBF


A loose upper bound on the maximum can be computed by recognizing that any single edge can be part of at most $3$ 3-cycles.

Thus, if each edge were to attain this maximum, there would be exactly $52$ 3-cycles in the graph.

By experimentation I do not believe this to be a tight upper bound, though it is difficult to prove; instead, I expect the attainable maximum to be approximately half of this upper bound, or roughly $26$.

As there are $6^{13} \approx 13$ billion different possible permutations, the computational resources required to check all possibilities one by one are prohibitive (5000 permutations checked per second would still take just over a month), but as it's clear there is a maximum possible number of 3-cycles and that it's at most 52, it doesn't seem it should be so difficult to find it and prove it....

Heuristically, it does seem to give good results to arrange each row such that each column contains all thirteen letters from A through M. And in particular, when the thirteen edges begun in each column form a Hamiltonian cycle (so that four disjoint Hamiltonian cycles contain all the edges in the graph), the count of 3-cycles seems to be higher. But this is only an indicated direction to look in and doesn't prove any maximum, nor does it explain why this should be the answer.

I've so far been unable to find any clear-cut simplifications that can be made on this problem, apart from the rather obvious one that half the permutations can be discarded as exact reflections of the other half (where each edge's direction has been reversed).

Also, I don't believe anyone has studied this interplay between block design and graph theory before, but if there is work already done on the subject I'd be very interested in reading it!

Playing with the smaller block design with 7 vertices and 21 edges, and ignoring the listed 3-cycles (as in the smaller version each row itself is a 3-cycle rather than being a 4-cycle), I successfully produced a graph with 7 additional 3-cycles, or half the upper bound (computed as above) of 14 cycles:

AGF
DAB
ECA
CDG
FED
BFC
GBE


Note that each column in this listing contains all 7 vertices, and the edges begun by the vertices in each column comprise 3 disjoint Hamiltonian cycles.

I did not prove that this is maximal for the smaller 7-21 case.