Define a domino to be an ordered pair of distinct positive integers. A proper sequence of dominoes is a list of distinct dominoes in which the first coordinate of each pair after the first equals the second coordinate of the immediately preceding pair, and in which and do not both appear for any and . Let be the set of all dominoes whose coordinates are no larger than . Find the length of the longest proper sequence of dominoes that can be formed using the dominoes of .
Solution
Consider the complete graph , over the set of vertices . To each domino in , we associate the edge joining the two vertices . In this way, to each edge in we have associated exactly two dominoes and , for some . A proper sequence of dominoes corresponds exactly to a path in which visits every edge at most once. The problem asks for the length of the longest such path. We will use and prove the following:
> If a finite graph is connected and each of its vertices has an even degree, there exists a closed path which visits all its edges exactly once. This closed path is called Eulerian.
We will prove this fact by induction on the number of edges of .
If has 3 edges, then it is a triangle and the statement is obvious. Assume there exists a closed Eulerian path in any connected graph with all vertices of even degree having less than or equal to edges.
Let be a connected graph with edges and all its vertices are of even degree. Let be a longest path visiting each edge of at most once.
Assume that starts and ends at different vertices . Path visits an odd number of edges incident to . But the degree of is even. Then, there exists an edge incident to which is not visited by and so, we can extend with . This contradicts the maximality of . Hence path starts and ends at the same vertex.
Assume that there exists an edge not visited by and let be a vertex incident to and a vertex visited by . Because is connected, there exists a path from to . Replace by the first vertex in this connecting path visited by . Let be the graph obtained by deleting from the graph all edges visited by and taking the connected component of . Graph contains edge and has less than edges. Each vertex of has even degree since path has visited precisely an even number of edges incident to . Hence, there exists a closed Eulerian path in . By considering in the path starting at and walking along all the path and then along all the path we obtain a longer path in visiting each edge at most once. This contradicts the maximality of . This proves that edge does not exist and that is Eulerian.
Back to our problem, we will consider two cases:
If is an odd number, the degree of each vertex of the complete graph is , even, and is connected. So there exists a path visiting all the edges of exactly once. Hence the longest proper sequence of dominoes that can be formed using the dominoes of uses all dominoes. It has length .
If is an even number, the degree of each vertex of the complete graph is odd. Let be a longest path visiting each edge at most once. For each vertex different from the starting and the ending vertices of , path visits an even number of edges incident to . So there exists at least one edge incident to not visited by . Because each edge is incident to two vertices, there exists at least edges not visited by . Hence the length of is less than or equal to .
Now, consider the graph obtained from by deleting the edges between and , and , and and , for . Graph is connected and all its vertices have even degree. So there exists an Eulerian closed path starting and ending at . Extending path in at the beginning with the edge between and and at the end with the edge between and , we obtain a path of length visiting each edge at most once. Hence the longest proper sequence of dominoes that can be formed using the dominoes of has length .