Partition Adjacency Matrix of Graph into Non-Overlapping Triangles

461 Views Asked by At

Take an undirected, complete graph with $n$ nodes. This can be represented by an adjacency matrix of size $n^2$ with $\frac{1}{2} (n^2-n)$ independent links.

A potential triangle consists of a set of links between $3$ nodes. Labelling the nodes by the alphabet, an example of a triangle is the set $\{ab, bc, ac\}$.

I define overlapping as two triangles which share a common link. For example, the triangles $\{ab, bc, ac\}$ and $\{bc, cd, bd\}$ overlap. Non-overlapping triangles share no common link.

There are $\binom{n}{3}$ possible triangles in total, if we allow for overlap. Q1: What is the largest subset, if we do not allow for overlap? Note that $\frac{1}{6}(n^2-n)$ gives an integer for $2$ out of $3$ $n$'s.

The following gif shows an adjacency matrix for $n=15$ where groups of $3$ nodes are highlighted according to some algorithm. (In some browsers, you need to refresh to see the animation.)

Adjacency Matrix

As can be seen, the algorithm does not manage to include all links in the set of all non-overlapping triangles. Furthermore, it does not work well for $n\neq15$. Q2: Find an algorithm which identifies a largest list of non-overlapping triangles for arbitrary $n$.

The following Mathematica code may help you along:

myPartitionAlgorithm[n_]:=Join[Table[{1+Mod[i-1,n], 1+Mod[i,n],1+Mod[i+2,n]},{i,1,n}],Table[{1+Mod[i-1,n], 1+Mod[i+3,n],1+Mod[i+n-6,n]},{i,1,n}]]
myPartitionedGrid[n_,partition_,t_]:=Grid[Table[If[i==j,"X",StringJoin[{Alphabet[][[i]],Alphabet[][[j]]}]],{i,1,n},{j,1,n}],Frame->All,Background->{None,None,Join[Table[{i,i}->Gray,{i,1,n}],Flatten[Table[{myColor=RGBColor[i/Length[partition],N[1/2+1/2 Sin[5 i]],N[1/2+1/2 Sin[i]]];partition[[i,{1,2}]]->myColor,partition[[i,{2,3}]]->myColor,partition[[i,{1,3}]]->myColor},{i,1,t}]]]}]
Manipulate[myPartition=Map[Sort,myPartitionAlgorithm[n]];myPartitionedGrid[n,myPartition,t],{{n,15,"Number of nodes"},3,26,1},{{t,2n,"Highlighted triangles"},0,2n,1}]
1

There are 1 best solutions below

2
On BEST ANSWER

This is equivalent to the problem in combinatorial design of finding a largest family $F$ of $3$-element subsets of an $n$-element set $S$ such that any two sets of $F$ share at most one element. In the graph-theoretic formulation, $S$ is the vertex set of the complete graph of order $n$, and $F$ is a collection of triangles such that no two share an edge.

Q1: The question of the maximum size of $F$ is asked and answered here.

Q2: The proof of the above result is constructive, providing an explicit construction of a largest $F$ for every $n$. The most important consideration is the remainder of $n\bmod 6$.

Case 1: $n\equiv1,3\pmod6$. Exactly in these two cases it is possible to include every pair of vertices in some set of $F$, i.e., every edge of the graph in some triangle. This construction is known as a Steiner triple system, abbreviated STS$(n)$, and popular constructions are the Bose construction for $n\equiv3\pmod6$ and the Skolem construction for $n\equiv1\pmod6$. These can be found in many places, e.g., the original papers, a book on combinatorial design, or elsewhere. The question of algorithmic implementation has been asked here, including one answer that uses an existing implementation in Sage.

Case 2: $n\equiv0,2,4,5\pmod6$. An STS$(n)$ does not exist, and this paper constructs the largest $F$ for these cases:

Case 2a: $n\equiv0,2\pmod6$. The maximum $F$ can be constructed by removing an element (vertex) from $S$ in the respective constructions for $n\equiv1,3\pmod6$.

Case 2b: $n\equiv4,5\pmod6$. The paper reduces the case of $n\equiv5\pmod6$ to that of $n\equiv4\pmod6$ and then constructs the maximum $F$ for the latter.

If you are interested in further exploration, this equivalent formulation as a problem in combinatorial design and survey of some results should help you find more resources on the topic.