GRAPHS INDUCED by GRAY CODES 1. Introduction an N-Bit
Total Page:16
File Type:pdf, Size:1020Kb
GRAPHS INDUCED BY GRAY CODES ELIZABETH L. WILMER AND MICHAEL D. ERNST Abstract. We disprove a conjecture of Bultena and Ruskey [1], that all trees which are cyclic graphs of cyclic Gray codes have diameter 2 or 4, by producing codes whose cyclic graphs are trees of arbitrarily large diameter. We answer affirmatively two other questions from [1], showing that strongly Pn Pn- compatible codes exist and that it is possible for a cyclic code to induce× a cyclic digraph with no bidirectional edge. A major tool in these proofs is our introduction of supercomposite Gray codes; these generalize the standard reflected Gray code by allowing shifts. We find supercomposite Gray codes which induce large diameter trees, but also show that many trees are not induced by supercomposite Gray codes. We also find the first infinite family of connected graphs known not to be induced by any Gray code | trees of diameter 3 with no vertices of degree 2. 1. Introduction n An n-bit Gray code B = (b1; b2;:::; bN ), N = 2 , lists all the binary n-tuples (\codewords") so that consecutive n-tuples differ in one bit. In a cyclic code, the first and last n-tuples also differ in one bit. Gray codes can be viewed as Hamiltonian paths on the hypercube graph; cyclic codes correspond to Hamiltonian cycles. Two Gray codes are isomorphic when one is carried to the other by a hypercube isomorphism. The transition sequence τ(B) = (τ1; τ2; : : : ; τN 1) of an n-bit Gray code B lists − the bit positions τi [n] = 1; 2; : : : ; n where bi and bi+1 differ. When B is cyclic, 2 f g its closing transition τN is the position where bN and b1 differ. We say τ gener- ates B when τ = τ(B). As transition sequences can be characterized simply and determine codes up to isomorphism, we treat codes and sequences interchangeably. n Proposition 1.1 (Gilbert [3]). Let τ = (τ1; τ2; : : : ; τN 1), where N = 2 . − (1) τ generates an n-bit Gray code if and only if every contiguous subsequence τk; τk+1; : : : ; τk+l contains some element of [n] an odd number of times. (2) τ generates a cyclic Gray code if and only if τ generates a Gray code and exactly one element of [n] appears an odd number of times in τ; that element is the closing transition. The graph GB induced by the Gray code B has vertex set [n] and edge set τi; τi+1 : i [N 1] , where τ(B) = (τ1; τ2; : : : ; τN 1). The vertices of GB cor- respondff tog bit2 positions;− g vertices i and j are adjacent− when bit positions i and j flip consecutively during the code B. Clearly, τ(B) determines GB. When B is cyclic with closing transition τN , its cyclic graph GB is GB together with the edges τN 1; τN and τN ; τ1 (which may or may not already appear in GB). f − g f g Proposition 1.1 ensures that τ(B) determines GB whenever B is cyclic. Given a graph G with vertex set [n], we call an n-bit Gray code B G-compatible when GB is a spanning subgraph of G | that is, when τ(B) is a walk on the edges 1 GRAPHS INDUCED BY GRAY CODES 2 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 P = 4 B 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 C B C @ 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 A 3 4 3 4 GP4 : t t GP4 : t t 1 2 1 2 t t t t Figure 1. The Gray code P4 has τ(P4) = (3, 1, 2, 1, 3, 1, 2, 4, 2, 1, 3, 1, 2, 1, 3) and closing transition 4. of G that visits every vertex. When B is a cyclic n-bit Gray code (as are most codes we consider), we distinguish another level of compatibility. A cyclic code B is strongly G-compatible when GB is a spanning subgraph of G | that is, when τ1; τ2; : : : ; τN 1; τN ; τ1 is a closed walk on G visiting every vertex. − Example. We write Pn for the n-path, Cn for the n-cycle, and Kn for the n-vertex complete graph. Figure 1 shows P4, a cyclic 4-bit code, together with GP4 = P4 and GP4 = C4. While the code P4 is P4-compatible, it is not strongly P4-compatible. The code P4 is, however, strongly C4-compatible and strongly K4-compatible. Remark. Because every bit must flip during a Gray code, every G-compatible code induces a connected spanning subgraph of G. When T is a tree, every T -compatible code induces T and every strongly T -compatible code has cyclic graph T . Slater [7, 8] was the first to ask: for which graphs G do G-compatible Gray codes exist | or, even better, strongly G-compatible cyclic codes? Bultena and Ruskey [1] independently arrived at this question, motivated in part by the search for Hamiltonian cycles on the cube-connected-cycle graph allowing simple traversal of the processors of certain parallel computers. Many types of restricted Gray codes, often motivated by applications, have been studied | see [2, 4, 6] for surveys. The current work makes progress in both positive (constructing Gray codes that induce new graphs) and negative (finding graphs G such that no G-compatible code exists) directions. Section 2 introduces supercomposite Gray codes. Bultena and Ruskey [1] conjecture that all trees induced by cyclic Gray codes have diameter 2 or 4; we disprove their conjecture by finding supercomposite codes whose cyclic graphs are trees of arbitrarily large diameter. We also find supercomposite Gray codes strongly compatible with non-degenerate grid graphs and show that many trees are not induced by supercomposite Gray codes. In Section 3, on digraphs of Gray codes, we construct a family of cyclic Gray codes whose cyclic digraphs contain no bidirectional edges. The concluding Section 4 surveys current understanding of which graphs are induced by Gray codes. We give the first infinite family of trees that can be proved to not be induced by codes, determine all 7-vertex graphs G for which G-compatible codes exist, and pose some new questions. 2. Supercomposite Gray Codes 2.1. Definitions. Supercomposite Gray codes are all those that can be built by two simple operations: shifting and reflecting. The term \supercomposite" is inspired by Gilbert [3], who gave a similar definition of \ultracomposite" Gray codes. GRAPHS INDUCED BY GRAY CODES 3 Breaking a cyclic Gray code between any two consecutive codewords yields an- other Gray code. Define the k-th shift of a cyclic code B to be k S (B) = (bk+1; bk+2;:::; bN ; b1; b2;:::; bk): (Shift parameters should be taken mod N. For example, S0(B) = B.) When B k has transition sequence (τ1; : : : ; τN 1) and closing transition τN ,S (B) has closing − transition τk and transition sequence (τk+1; τk+2; : : : ; τN 1; τN ; τ1; τ2; : : : ; τk 1): − − Although G(Sk(B)) = G(B) for any k, shifts can add or subtract edges in the (or- dinary) induced graph of a code. Define a cyclic Gray code B to be sufficient when its graph is constant under shifts; that is, GSk(B) = GB for every k. A cyclic code B with transition sequence (τ1; : : : ; τN 1) is sufficient if and only if every edge in − GB has two non-consecutive appearances in the closed walk τ1; τ2; : : : ; τN 1; τN ; τ1; − thus, B sufficient implies GB = GB. The reflection of an n-bit Gray code B = (b1; b2;:::; bN ) is the n + 1-bit code b b b b b b Rf(B) = 1 2 N N 2 1 : 0; 0;:::; 0 ; 1 ;:::; 1; 1 This code is cyclic with closing transition n + 1. When τ(B) = (τ1; τ2; : : : ; τN 1), − τ(Rf(B)) = (τ1; τ2; : : : ; τN 1; n + 1; τN 1; : : : ; τ2; τ1): − − Reflecting a code simply adds a leaf to its graph. Shifting before reflection changes where the leaf is added; shifting after reflection can add a second edge. Proposition 2.1 anatomizes these effects. Proposition 2.1. Let τ = (τ1; τ2; : : : ; τN 1) generate a cyclic n-bit Gray code with − closing transition τN and let j and k be integers. Then: (1) GRf(Sj (τ)) is GSj (τ) plus the new leaf n + 1 attached to τj 1. In GRf(Sj (τ)), − n + 1 is adjacent to both τj 1 and τj+1. − (2) GSk(Rf(Sj (τ))) is GSj (τ) plus the new vertex n+1 attached to: τj 1 when k 0 − ≡ (mod 2N), τj+1 when k N (mod 2N), and both τj 1 and τj+1 otherwise. j ≡ − (3) Rf(S (τ)) is sufficient if and only if τj+1 = τj 1. − Proof. (1) Because n + 1 appears once in Rf(Sj(τ)), between two occurrences of τj 1, n + 1 is adjacent only to τj 1 in GRf(Sj (τ)). As closing transition, n + 1 is − − flanked on both sides by τj+1. Thus n + 1 is also adjacent to τj+1 in GRf(Sj (τ)). (2) Every edge of GRf(Sj (τ)) not incident to n + 1 appears on both sides of the reflection and thus is in G k j for every k.