Extending perfect matchings to Gray codes with prescribed ends

A binary (cyclic) Gray code is a (cyclic) ordering of all binary strings of the same length such that any two consecutive strings differ in a single bit. This corresponds to a Hamiltonian path (cycle) in the hypercube. Fink showed that every perfect matching in the n-dimensional hypercube Qn can be extended to a Hamiltonian cycle, confirming a conjecture of Kreweras. In this paper, we study the “path version” of this problem. Namely, we characterize when a perfect matching in Qn extends to a Hamiltonian path between two prescribed vertices of opposite parity. Furthermore, we characterize when a perfect matching in Qn with two faulty vertices extends to a Hamiltonian cycle. In both cases we show that for all dimensions n > 5 the only forbidden configurations are so-called half-layers, which are certain natural obstacles. These results thus extend Kreweras’ conjecture with an additional edge, or with two faulty vertices. The proof for the case n = 5 is computer-assisted. Mathematics Subject Classifications: 05C38, 05C45, 05A15


Introduction
A binary (cyclic) n-bit Gray code is a (cyclic) ordering of all 2 n binary strings of length n such that any two consecutive strings differ in a single bit.Alternatively, it can be viewed as a Hamiltonian path (cycle) in the n-dimensional hypercube Q n .It is named after Frank Gray who in 1953 patented a scheme based on this code to convert analog signals to digital [10] but its description can be traced back much earlier in history [11,12].
Gray codes turned out to be useful and flexible at the same time [6].Applications have been found in such diverse areas as data compression, graphics and image processing, information retrieval, signal encoding or processor allocation in hypercubic networks [17].Gray codes satisfying certain additional properties have been subject of extensive research with recent breakthroughs, e.g.confirmation of the Middle Levels Conjecture [14].
Ruskey and Savage [16] asked if any matching in a hypercube Q n can be extended to a Hamiltonian cycle.This question is still open in general, although for small dimensions (n 5) [20], for small matchings (bounded by a O(n 2 ) function) [3,7,19], or for an extension into 2-factors [9,18] it has been answered positively.Another special case when the matching is perfect was independently conjectured by Kreweras [13].This has been affirmatively answered by Fink [8] who proved a strengthened version of Kreweras' conjecture for the complete graph K(Q n ) on the vertices of the hypercube Q n .
Theorem 1 (Fink [8]).Let P be a perfect matching of K(Q n ).There exists a perfect matching R of Q n such that P ∪ R induces a Hamiltonian cycle of K(Q n ).
In this paper, we study the "path version" of this problem.Namely, in the following theorem we characterize when there is a Hamiltonian path in the hypercube Q n between two given vertices x, y of opposite parity containing a given perfect matching.This can be also viewed as an extension of Kreweras' conjecture with one additional edge xy.Similarly as Fink employed a strengthened version in Theorem 1 for the graph K(Q n ), we need a strengthened version for the complete bipartite graph B(Q n ) on the vertices of Q n (with the same bipartition).
Theorem 2. Let P be a perfect matching of B(Q n ), n 5, and let x, y be vertices of opposite parity with xy ∈ P .There exists a matching R ⊆ E(Q n ) such that P ∪ R forms a Hamiltonian xy-path of B(Q n ) if and only if (P ∪ x P y P ) \ {xx P , yy P } does not contain a half-layer, where x P and y P are the vertices such that xx P , yy P ∈ P .
A half-layer in Q n is a set of edges with the same direction and the same parity, see the definitions below.Our result shows that these easy to recognize configurations are the only obstacles.For convenience in the induction proof we actually prove the following equivalent and shorter form of Theorem 2. Theorem 3. Let x, y be vertices of opposite parity in Q n , n 5, and let P be a perfect matching of B(Q n − {x, y}).There exists a matching R ⊆ E(Q n ) such that P ∪ R forms a Hamiltonian cycle of B(Q n − {x, y}) if and only if P does not contain a half-layer.
To see that Theorem 3 implies Theorem 2, assume that P is a perfect matching of B(Q n ), n 5, and x, y are vertices of opposite parity with xy ∈ P .Let P = (P ∪ x P y P ) \ {xx P , yy P } where x P and y P are the vertices such that xx P , yy P ∈ P .Observe that for any matching R ⊆ E(Q n ) the set of edges P ∪R forms a Hamiltonian path between x and y in B(Q n ) if and only if P ∪ R is a Hamiltonian cycle of B(Q n − {x, y}).By Theorem 3 there exists such matching R if and only if P does not contain a half-layer.
On the other hand, to see that Theorem 2 implies Theorem 3, assume that x, y are vertices of opposite parity in Q n , n 5, and P is a perfect matching of B(Q n − {x, y}).Choose any edge x P y P ∈ P and let P = (P \ {x P y P }) ∪ {xx P , yy P } assuming that x P and y P have opposite parity to x and y, respectively.Observe that for any matching R ⊆ E(Q n ) the set of edges P ∪R forms a Hamiltonian cycle of B(Q n −{x, y}) if and only if P ∪ R is a Hamiltonian xy-path of B(Q n ).By Theorem 2 there exists such matching R if and only if P does not contain a half-layer.
Theorem 3 can be also viewed as another extension of Kreweras' conjecture for hypercubes with two faulty vertices x, y of opposite parity.In [1] the authors showed that Kreweras' conjecture also holds for sparse spanning regular subgraphs of hypercubes.As for other related results, in a more general setting when the prescribed edges can be incident (i.e.not necessarily a matching) it is known [4,5] that any 2n − 3 (resp.2n − 4) edges satisfying certain necessary conditions can be prescribed for a Hamiltonian cycle (resp.for a path between given vertices), and these bounds are tight.In a sense complementary results characterize when there is a Hamiltonian cycle (resp.path) in Q n that avoids a given matching [2].In particular, a Hamiltonian cycle exists in Q n − M for n 4 if and only if the forbidden matching M does not contain a half-layer [2].Thus half-layers are the only obstacles in the complementary problem as well.
It should be noted that our proof is computer-assisted; the case n = 5, which serves us as a base of induction, was verified on computer by an exhaustive checking of all non-isomorphic configurations.
The paper is organized as follows.In Section 2 we introduce definitions and notation.In Section 3 we study half-layers and quad-layers that play a key role as obstacles in our results.In Section 4 we prove the induction step of Theorem 3. In Section 5 we conclude with discussion of a possible generalizations.In Appendix we describe our algorithm that verifies the base of induction for n = 5.The source code of the verifying algorithm in C++ is available on [15].

Preliminaries
For a positive integer n we denote by [n] the set {1, 2, . . ., n}.As usual, the vertex and the edge sets of a graph G are denoted by V (G) and E(G), respectively.For sets of so-called and let G − E denote the graph with vertices V (G) and edges E(G) \ E. For a graph G we denote by K(G) the complete graph on vertices V (G), and if G is bipartite with a unique bipartition, we denote by B(G) the complete bipartite graph on vertices V (G) with the same bipartition.Note that The n-dimensional hypercube Q n is a (bipartite) graph with all binary vectors of length n as vertices and with edges joining every two vertices that differ in exactly one coordinate, i.e.The weight w(v) of a vertex v is the number of 1's in v, i.e. w(v) = d(v, 0) where 0 = (0 • • • 0).Furthermore, for an edge uv we define its weight w(uv) = min{w(u), w(v)}, i.e. it is the weight of its vertex closer to 0. The parity of a vertex or an edge is the parity of its weight.Note that vertices of each parity form bipartite sets of Q n .We denote (on illustrations) the set of even (odd) vertices by W (resp. B).Consequently, any two vertices u and v have the same parity if and only if d(u, v) is even.
For any i ∈ [n], let Q i L and Q i R be the (n − 1)-dimensional subcubes that are induced by all vertices with fixed 0 and 1 (respectively) in the i-th coordinate.Clearly, each Thus, E(Q n ) can be partitioned into n layers, one layer for each i ∈ [n].For a vertex x of Q n and i ∈ [n] let x i denote the neighbor of x in direction i.

Half-layers and quad-layers
In this section we study half-layers and quad-layers which are natural obstacles that need to be avoided in our inductive construction.
Notice that an edge A half-layer is odd (resp.even) if its edges are odd (resp.even).Every layer comprises two disjoint half-layers, one odd and one even.See Figure 1 for an illustration.Clearly, any two edges in a half-layer have distance at least 2. Furthermore, observe that a half-layer of Q n does not belong to any (n − 1)-dimensional subcube if n 3. The following lemma shows that two half-layers of different directions are incident in a strong sense.Lemma 4. Let H i and H j be half-layers of Q n of different directions i and j, respectively.Then, every edge of H i is incident with some edge of H j .Proof.Let xx i be an edge from H i .Notice that the edges xx j and x i (x i ) j are both of direction j and both are incident with the edge xx i .Moreover, they are of different parity, so precisely one of them is in H j .See Figure 2   (a) even (green) and odd (red) half-layers of direction i, the red half-layer is x-dangerous, but the green is not; (b) the red almost half-layer is x-dangerous, but the green is not.
Since we proceed in the proof of Theorem 3 inductively by splitting Q n into two (n − 1)-dimensional subcubes, we need to consider so-called quad-layers.A quad-layer the electronic journal of combinatorics 25(2) (2018), #P2.56 (of direction i) is a half-layer (of direction i) in some (n − 1)-dimensional subcube.If j is the fixed direction of this (n − 1)-dimensional subcube (i.e. it is one of Q j L and Q j R ), then it is called a j-separate quad-layer (of direction i).Note that such j is unique for every quad-layer if n 4. (For n = 3 a quad-layer of direction i contains a single edge and is j-separate for both j ∈ [n] \ {i}.)Observe that every half-layer can be partitioned into two quad-layers in n − 1 ways.See Figures 3(a The following lemma shows that half-layers and quad-layers may occur in a matching of K(Q n ) (and thus also of B(Q n )) only in a limited number of directions.It is used only in the proof of Lemma 7.
Lemma 5. Let P be a matching of K(Q n ).Then, (i) P contains half-layers in at most one direction; (ii) if n 4, then P contains quad-layers in at most two directions.
Proof.The first claim follows immediately by Lemma 4. For the second claim, suppose that we have three quad-layers L 1 , L 2 , L 3 in P of distinct directions d 1 , d 2 , d 3 , respectively.Let L i be an s i -separate quad-layer for i = 1, 2, 3.
If s 1 = s 2 = s 3 , then at least two of the quad-layers belong to the same L , and we obtain a contradiction by Lemma 4. So at least one of s 1 , s 2 , s 3 is distinct from the other two.By renumbering the quad-layers we may assume in the sequel that it is s 1 , so s 1 = s 2 and s 1 = s 3 .
As s 1 = s 2 , we argue in the following way.Without loss of generality, we may assume that So, it follows that either x or y is incident with an edge of L 2 .This is a contradiction that establishes our claim.As n 4, it follows that the (n − 2)-cube L is too small to contain all edges of L 2 .So we conclude that the edges of In an analogous way, from s 1 = s 3 we can conclude that d 1 = s 3 and d 3 = s 1 .However, now we obtain that d 2 = s 1 = d 3 , which is a contradiction with the assumption that directions d 1 , d 2 , d 3 are distinct.
Notice that a quad-layer in Q 3 consists of a single edge and Q 3 contains a matching consisting of three edges of distinct directions, thus the bound n 4 in the second claim of the above lemma cannot be decreased.
In the proof of Theorem 3, namely in Case 2(b)(i), we need to add a single given edge to the prescribed matching in one subcube without introducing a half-layer in the matching.This motivates the following definitions.
Let L be a layer and uv be an edge of L. We say that L \ {uv} is an almost layer.Similarly, we define an almost half-layer and an almost quad-layer.So, an almost layer, an almost half-layer, and an almost quad-layer miss one edge to become a layer, a half-layer, and a quad-layer, respectively.Observe that any almost half-layer of Q n does not belong to any (n − 1)-dimensional subcube if n 4. See Figures 3(b) and 4(b) for an illustration.
For almost half and quad-layers we have the following lemma, analogous to Lemma 5.It is also used only in the proof of Lemma 7. Lemma 6.Let P be a matching of K(Q n ) with n 4.Then, (i) P contains almost half-layers in at most one direction; (ii) if n 6, then P contains almost quad-layers in at most two directions.
Proof.Let L 1 , L 2 be two almost half-layers of Q n in different directions.Since n 4, the set L 1 contains at least 3 edges.By Lemma 4, at most one of them is not incident with L 2 .Thus L 1 , L 2 cannot be both in the matching P , which proves the first claim.For the second claim, we proceed similarly as in the proof of Lemma 5. Suppose that we have three almost quad-layers L 1 , L 2 , L 3 in P of distinct directions d 1 , d 2 , d 3 , respectively.Let L i be an s i -separate almost quad-layer for i = 1, 2, 3.
If s 1 = s 2 = s 3 , then at least two of the almost quad-layers belong to the same (n − 1)dimensional subcube L , and we obtain a contradiction with the claim (i) for P ∩ Q s 1 L .So at least one of s 1 , s 2 , s 3 is distinct from the other two.By renumbering the almost quad-layers we may assume in the sequel that it is s 1 , so s 1 = s 2 and s 1 = s 3 .
As s 1 = s 2 , we argue in the following way.Without loss of generality, we may assume that L contains at most one edge of L 1 and at most one edge of L 2 .Otherwise, suppose that two edges the electronic journal of combinatorics 25(2) (2018), #P2.56 d 2 = d 1 , at least one of the vertices x 1 , x 2 , y 1 , y 2 is incident with L 2 .This is a contradiction that establishes our claim.
As n 6, it follows that the (n − 2)-cube L can contain at most 2 n−4 edges with mutual distance at least 2, but 2 n−3 − 2 > 2 n−4 for n 6.So we conclude that the edges of In an analogous way, from s 1 = s 3 we can conclude that d 1 = s 3 and d 3 = s 1 .However, now we obtain that d 2 = s 1 = d 3 , which is a contradiction with the assumption that directions d 1 , d 2 , d 3 are distinct.
In the proof of Theorem 3, quad-layers may lead to obstacles only if they are in the (n − 1)-dimensional subcube containing one of the removed vertices.This motivates the following additional definitions.
Let x be a vertex of Q n .If x is not incident with any edge of a half-layer L of Q n , then we say that L is x-dangerous.A quad-layer L is x-dangerous, if it is an x-dangerous halflayer in some (n − 1)-dimensional subcube which contains x.Furthermore, we define an x-dangerous almost half-layer as an x-dangerous half-layer without one edge.Similarly, an x-dangerous almost quad-layer is an x-dangerous quad-layer without one edge.See Figures 3 and 4 for an illustration.The following statements are simple observations: (o1) Every x-dangerous half-layer covers n − 1 neighbors of x.Namely, if the half-layer is of direction i, then the only uncovered neighbor of x is x i .
(o2) Every x-dangerous quad-layer covers n − 2 neighbors of x.Namely, if the quad-layer is j-separated and of direction i, then the only uncovered neighbors of x are x i and x j .
(o3) Every x-dangerous almost quad-layer covers at least n − 3 neighbors of x.
In the following lemma we restate the above two lemmas for hypercubes with two faulty vertices of opposite parity.Additionally, we include similar statements also for x-dangerous half and quad-layers.This lemma is used in the proof of Theorem 3.
Lemma 7. Let P be a matching of K(Q n − {x, y}), where x, y are vertices of opposite parity.Then, (i) P contains half-layers in at most one direction; (ii) P contains quad-layers in at most two directions for n 4; (iii) P contains x-dangerous quad-layers in at most one direction for n 4; (iv) P contains almost half-layers in at most one direction for n 4; (v) P contains almost quad-layers in at most two directions for n 6; the electronic journal of combinatorics 25(2) (2018), #P2.56 (vi) P contains x-dangerous almost quad-layers in at most one direction for n 6.
Proof.The claims (i), (ii) and (iv), (v) follow directly from Lemmas 5 and 6, respectively.Now we consider the claim (iii).By (ii), x-dangerous quad-layers could be in at most two directions, say i and j.Suppose that L i and L j are x-dangerous quad-layers of directions i and j, respectively.Since x is not covered by L i ∪ L j and (x i ) j is not covered by both L i , L j , it follows that at least one of x i , x j is not covered by L i ∪ L j .Since each of L i , L j covers n − 2 neighbors of x by (o2) and n 4, some neighbor must be covered by both, a contradiction.
The claim (vi) is proven in the same way as the claim (iii).The only difference is in counting.Each of x-dangerous almost quad-layers L i , L j covers at least n − 3 neighbors of x by (o3) and n 6, which again leads to a contradiction.

Proof of Theorem 3
Proof.First we prove the necessity.Assume that P contains a half-layer L of direction i.We may assume that x ∈ V (Q i L ) and that the half-layer L is even, i.e. it covers the set A of even vertices in Q i L and x is odd.Let B denote the set of odd vertices in Q i L distinct from x. Assume by way of contradiction that there is a matching R ⊆ E(Q n − {x, y}) such that P ∪ R forms a Hamiltonian cycle of B(Q n − {x, y}).However, this is impossible, as R must match each element of A to a distinct element of B and |A| > |B|.
For the other direction (sufficiency) assume that P does not contain a half-layer.We proceed by induction on n.For n = 5 we verified the sufficiency part of Theorem 2 by computer, see the Appendix for a description of the verifying algorithm.This implies that also the sufficiency part of Theorem 3 holds for n = 5.Now we assume that the statement holds for n − 1 and we prove it for n 6.The main idea is to cut the cube into two subcubes through a carefully selected direction d in order to apply induction.In the case when both x, y belong to the same subcube, say Q L , we first apply induction in Q L and use Theorem 1 in Q R and finally combine both matchings in order to obtain the required matching R. In the case when x and y are in different parts, say x in Q L and y in Q R , we choose some y ∈ V (Q L ) and x ∈ V (Q R ) in order to apply induction in both parts, and afterwards we again combine the obtained matchings.Now we specify how to determine d.If P contains an x-dangerous or y-dangerous (almost) quad-layer, then we use the direction of such (almost) quad-layer for d.Note that by Lemma 7(vi) we may have two choices for d, one for an x-dangerous (almost) quad-layer and one for an y-dangerous (almost) quad-layer.If P does not contain an x-dangerous or y-dangerous (almost) quad-layer, we choose for d a direction with the maximal number of edges of P between Q d L and Q d R .As n 6, an almost quad-layer has at least 7 edges.A direction with the maximal number of edges of P between the subcubes contains at least (2 n−1 − 1)/n 6 edges.Thus, there are at least 6 edges of P between Q d L and Q d R .Let P L and P R denote the set of edges of P in Q L and Q R , respectively, and let A denote the set of edges of P between the subcubes; thus, P = P L ∪ P R ∪ A and By Lemma 7(vi) and the choice of d, we obtain that x or y has no (almost) half-layer from P inside its subcube.So, without loss of generality, we can assume that x has this property; otherwise we swap x and y.Moreover, we can assume that x is in Q L ; otherwise we swap Q L and Q R .Thus P L does not contain an (almost) half-layer of Q L .Now, we distinguish two cases regarding whether y belongs to Then the modified M L with P L contains no half-layer by Lemma 4. By applying induction in Q L for P * L we obtain a set of edges Notice that H L − M L is a union of some vertex-disjoint paths P 1 , P 2 , . . ., P k , each with endvertices of opposite parity.Let us denote the endvertices of P j by u j , v j ∈ A L , and furthermore let us denote by u A j , v A j ∈ A R their neighbors through the edges of A, i.e.Case 2: y is in Q R .We distinguish two subcases: (a) P R contains a half-layer B of Q R .See Figure 6 for an illustration.Notice that B is y-dangerous.First we choose a vertex x in Q R of opposite parity to y that is covered by some edge x b of B, and we put Second, we extend P L on A L by some edges M L to a perfect matching P * L of B(Q L − {x, y }) so that P * L contains no half-layer of Q L .This can be done since P L does not contain a half-layer in Q L and |A L | 6, recall the choice of M L in Case 1.By applying induction in Q L for P * L we obtain a set of edges Next, we take the matching M R of B(Q R − {x , y}) on vertices of A R exactly as in Case 1 but with respect to the set A = A ∪ {ab} instead of A. Thus M R extends the matching P R on A R to a perfect matching . By Lemma 7(iv), P * R does not contain a half-layer of Q R since P R already contains an almost half-layer B \ {x b} and the edge x b cannot occur in M R (it is not an edge of B(Q R − {x , y})).

Thus, we may apply induction again in
(b) P R contains no half-layer of Q R .In this case, to be able to apply induction in Q R for the matching P * R we will carefully choose the edges of the matching M L so that it is guaranteed that P * R has no half-layer in Q R .First, since P contains no half-layer of Q n , there is a vertex x in Q R of opposite parity to y such that x y ∈ P where y = (x ) d is the neighbor of x in Q L .Similarly as in the previous subcase, we define P R = P R \ {x b}, P L = P L \ {y a}, A R = A R ∪ {b}, A L = A L ∪ {a} where a, b are the vertices such that x b, y a ∈ P .
We say that a direction j ∈ [n] \ {d} is dangerous if P R can be extended on A R to a perfect matching P * R of B(Q R − {x , y}) containing a half-layer of Q R in direction j.Clearly, such half-layers are y-dangerous.
(i) At most one direction is dangerous.If no direction is dangerous then we may proceed exactly as in Subcase (a).Now assume that j is a dangerous direction.
Our aim is to first choose one edge for the matching M L so that it is guaranteed that later the matching M R does not introduce the half-layer in direction j into any edge of the y-dangerous half-layer in direction j of Q R such that u A , v A ∈ A R , and let u, v ∈ A L be the neighbors of u A , v A through the edges of A, i.e. uu A , vv A ∈ A. Note that P L ∪{uv} does not contain a half-layer since there was no almost half-layer in P L , and recall that |A L | 6.Thus we may extend P L on A L by some edges M L including the edge uv to a perfect matching P * L of B(Q L − {x, y }) so that P * L contains no half-layer of Q L .The choice of M L can be done as in the previous cases except that the edge uv has to be kept in M L .The rest is the same as in the subcase (a).Note that the edge u A v A cannot appear in M R , since M L contains the edge uv and hence u, v cannot be the endvertices of the same path in H L − M L .Therefore it is guaranteed that P * R = P R ∪ M R contains no half-layer as required.(ii) There are k 2 dangerous directions.We proceed similarly as in Subcase (i).
Our aim is to first choose k edges for the matching M L , one for each dangerous direction, so that we again "forbid" all possible half-layers later in Notice that |P L | = |P R |.By Lemma 4, no edge of a y-dangerous half-layer in a dangerous direction is in P R .Furthermore, y-dangerous half-layers of Q R in k dangerous directions cover (together) all but 2 n−k−1 vertices of Q R as they have the same parity.Since the matching P R can pair only those 2 n−k−1 vertices and x , y are not paired, we obtain that |P R | 2 n−k−2 − 1.This establishes the claim (1).Now we pick the edges to "forbid" dangerous half-layers.Let S be the following set of n independent edges between all the neighbors of y and distinct vertices at distance 2 from y: Clearly, every direction appears exactly once in S. Furthermore, if uv ∈ S has a dangerous direction, then uv belongs to a y-dangerous half-layer and thus the electronic journal of combinatorics 25(2) (2018), #P2.56 u, v ∈ A R .For each such edge uv we choose the edge u A v A for M L where u A , v A ∈ A L such that uu A , vv A ∈ A. If we add these k edges chosen for M L into P L , can P L contain a half-layer of Q L ?By claim (1), we would have at most 2 n−k−2 −1+k edges, which is strictly less than 2 n−3 as k 2, the size of a half-layer in Q L , so the answer is negative.Therefore, P L can be extended on A L by some edges M L including the above already chosen edges to a perfect matching P * L = P L ∪ M L of B(Q L − {x, y }) so that P * L contains no half-layer of Q L .Similarly as before, the choice of other edges of M L can be done arbitrarily and if P L ∪ M L contains a half-layer, it can be corrected by switching the endvertices of two suitable edges.The rest is the same as before.

Conclusions
In this section we discuss possible extensions.In both Theorems 2 and 3 we assume that n 5.As for smaller dimensions, it is easy to check that they both hold also for n = 3.However, for n = 4 there are other particular exceptional configurations, see their list for Theorem 3 on Figures 7 and 8 Let us state it formally only for Theorem 3. Conjecture 8. Let x, y be vertices of opposite parity in Q n , n 5, and let P be a perfect matching of K(Q n − {x, y}).There exists a matching R ⊆ E(Q n ) such that P ∪ R forms a Hamiltonian cycle of K(Q n − {x, y}) if and only if P does not contain a half-layer.The proof of the necessity in Conjecture 8 is the same as in our proof.However, for the sufficiency in Conjecture 8 we were not able to verify the case n = 5 even with the help of computer (the number of non-isomorphic configurations is unmanageable in this case.)Our proof in Section 4 thus only provides the following implication.For the sake of completeness, we also note that for n = 4 there are two additional exceptional configurations for Conjecture 8, see Figure 9.The diameter of Q n is n, so each edge has length at most n.Therefore, if there exists an edge of length 3, we may set the first edge to be {0, 7}.For n = 3 and n = 4 there are no other possibilities.However, for n = 5 it is possible to have all edges of length 5.But then all edges are uniquely determined, so we may add that perfect matching separately.
Observation 11 allows to divide the program into 2 n−1 +1 independent cases depending on the number of short edges so we can run it for all of these cases in parallel.

A.1.1 Pruning non-perspective branches
Let us suppose that we want to add an edge uv into a partial matching.There are two simple cases when this branch can be skipped: 1. Adding the selected edge into the matching violates the requirement for the number of short edges.
2. Adding the selected edge creates a partial matching isomorphic to some matching generated earlier.
The first condition is clear, the second comes from Observation 12.In the program, the first condition is checked in two cases.If uv ∈ E(Q n ), then we increase the number of used short edges by one.If this number extends the requirement, this edge cannot be used.Otherwise uv ∈ E(Q n ); then we compare the number of short edges still needed to be added and the number of available short edges on uncovered vertices.If there are not enough short edges left, we cannot fulfil the requirement.
The second condition is checked only partially, only when the number of used edges is not greater than 10.This relaxation must be done because of fast increasing memory requirements to store all visited states.Moreover, searching for the correct isomorphism is a relatively expensive operation, thus more frequent filtering can even be slower.

A.1.2 Isomorphism testing
The following characterization of the hypercube automorphisms is a well-known fact.
Observation 13.Every automorphism of hypercube is composed of a unique transposition (i.e.switching certain coordinates) and a unique permutation of coordinates.
For example, for n = 5 there are exactly 2 5 • 5! different automorphisms of Q n .Therefore, searching for an isomorphic matching among all generated matchings by trying all of the automorphisms would be too slow.Definition 14.For a matching M , let the signature of M be the 2 n -dimensional vector (a 0 , a 1 , . . ., a 2 n −1 ), where for every i ∈ {0, 1, . . ., 2 n − 1}, a i = the index of the neighbor of i in M if i is covered by M , 2 n otherwise.
the electronic journal of combinatorics 25(2) (2018), #P2.56where ∆(u, v) = {i ∈ [n] | u i = v i }.Thus the distance of vertices u and v is d(u, v) = |∆(u, v)|.The distance of two edges uv and xy is the minimal distance between a vertex of uv and a vertex of xy.

Figure 1 :
Figure 1: A lattice representation of the hypercube: (a) even (green) and odd (red) edges, (b) a layer in the direction i, (c) even (green) and odd (red) half-layers in the direction i.

Figure 2 :
Figure 2: An illustration for Lemma 1: every edge of the green half-layer is incident with some edge of the red half-layer.
for an illustration.

Figure 3 :
Figure3: A schematic representation of half-layers (the blue line represents the bipartition): (a) even (green) and odd (red) half-layers of direction i, the red half-layer is x-dangerous, but the green is not; (b) the red almost half-layer is x-dangerous, but the green is not.

Figure 4 :
Figure 4: A schematic representation of quad-layers: (a) red, green, blue, and black are j-separate quad-layers of direction i, only the red quad-layer is x-dangerous; (b) red, green, blue, and black are (j-separate) almost quad-layers, only the red almost quad-layer is x-dangerous.

Figure 5 :
Figure 5: Three steps in Case 1: (a) extending P L by a matching M L on vertices of A L ; (b) applying induction in B(Q L − {x, y}) and the matching M R obtained on vertices of A R ; (c) applying Theorem 1 in Q R .

Figure 5
for an illustration.Since P L contains no (almost) half-layer of Q L and |A L | 6, we can easily extend P L on the vertices of A L by some new edges M L of B(Q L −{x, y}) to a perfect matching P * L = P L ∪M L of B(Q L −{x, y}) so that P * L contains no half-layer.Indeed, take an arbitrary matching M L of B(Q L − {x, y}) on A L and if P L ∪ M L contains a half-layer B, choose an edge u B u W ∈ M L ∩ B and any other edge v B v W ∈ M L and swap their endvertices; that is, take M

Figure 6 :
Figure 6: Three steps in Case 2(a): (a) extending P L by a matching M L on vertices of A L ; (b) applying induction in B(Q L − {x, y }) and the matching M R obtained on vertices of A R ; (c) applying induction in B(Q R − {x , y}). .

Figure 7 :
Figure 7: All (up to isomorphism) configurations of (thick red) perfect matchings of B(Q 4 − {x, y}) for d(x, y) = 1 that do not contain a half-layer but cannot be extended by (thin black) edges of Q 4 − {x, y} to a Hamiltonian cycle.

Figure 8 :
Figure 8: All (up to isomorphism) configurations of (thick red) perfect matchings of 4 − {x, y}) for d(x, y) = 3 that do not contain a half-layer but cannot be extended by (thin black) edges of Q 4 − {x, y} to a Hamiltonian cycle.

Theorem 9 .
If Conjecture 8 holds for n = 5 then it holds for all n 5.

Figure 9 :
Figure9: Two additional (up to isomorphism) configurations of (thick red) perfect matchings of K(Q 4 − {x, y}) that do not contain a half-layer but cannot be extended by (thin black) edges of Q 4 − {x, y} to a Hamiltonian cycle.