Determination of Hamiltonian cycles in cube-based networks using generalized Gray Codes

  • Published on

  • View

  • Download

Embed Size (px)


  • Pergamon Computers Herr. Engng Vol. 21, No. 3, pp. 189499, 1995

    0045-7906(95)ooool-1 Copyright 0 19% Elsevier Science Ltd

    Printed in Great Britain. All rights reserved 004%7906/9S $9.50 + 0.00



    SHAHRAM LATIFI and SEQING ZHENG* Electrical and Computer Engineering Department, UNLV, 4505 Maryland Parkway, Las Vegas, Nev.

    and 2Computer Science Department, LSU, Baton Rouge, La, U.S.A.

    (Received 5 January 1995)

    Abstract-Gray Codes (GCs) are useful in finding the Hamiltonian path, embedding linear and mesh graphs, and identification of operational subcubes in a cube with some already allocated regions. We generalize the conventional GCs by allowing the successive codewords to have a Hamming distance of greater than one when necessary. This generalization provides a useful methodology for solving such problems as: embedding, subnetwork allocation and deallocation, and fault tolerant routing for non- standard cube-based networks. To demonstrate the usefulness of this GC characterization, we focus on the problem of ring (or linear array) embedding into viable alternatives of the n-cube., namely, folded hypercube, incomplete hypercube, twisted hypercube and multiply-twisted hypercube. We show the power of the link label representation in identifying the Hamiltonian paths (cycles) in the cube.-based networks. Using the unified link label representation, Gray Codes are derived for the aforementioned networks. The available distinct GCs for each network are further enumerated. The GCs obtained as such render Hamiltonian cycles for each cube-based topology, thus providing embedding of rings (or linear arrays) of maximum size onto the cube. It is believed that the generalized GCs introduced here can be employed to solve many other problems in networks whose connectivity is defined by the binary labels of nodes.

    Key worak Cube-based networks, embedding, Gray Codes, Hamiltonian cycle, Hamiltonian path, ring.


    Hypercube multiprocessors have been the focus of many researchers over the past few years. The appealing properties of the hypercube such as node and edge symmetry, logarithmic diameter, high fault resilience, scalability and the ability to host popular interconnection networks have made this topology an excellent candidate for many parallel processing applications [l]. Viable alternatives to the standard hypercube have been proposed such as: folded hypercube [2,3], incomplete hypercube [4], twisted hypercube [5], multiply-twisted hypercube [6], and generalized hypercube [7].

    With the widespread availability of parallel and distributed architectures based on the hypercube topology, there is an ever-increasing interest in the portability of algorithms developed for architectures based on other topologies such as linear arrays and rings. Clearly, the problem of portability reduces to one of embedding the above interconnection structures into the hypercube. In embedding a given topology, it is imperative to maximize the processor utilization in the hypercube. This problem can be modeled as one of mapping a given topology of largest size onto the hypercube. The topology to be mapped onto the hypercube is called the guest graph, while the hypercube itself is commonly referred to as the host graph. Also, it is desirable for the embedding function to preserve the neighborhood property of the guest graph, i.e. the edges of the guest graph are mapped to edges in the host graph.

    Linear arrays and rings are among highly structured topologies frequently demanded by parallel applications. Therefore, it is important to develop efficient embedding techniques which map these topologies onto the hypercube. A powerful mathematical tool for linear array and ring embedding is the Gray Code (GC) concept. Gray Codes also have many other important applications in parallel computing on cube-based networks. Cube-based networks are usually recursively defined, and their connectivity is succinctly represented by the binary node labels. Thus, to specify the

    tThis work was supported in part by the University of Nevada, Las Vegas Information Science Research Institute.


  • 190 Shahram Latifi and Si-Qing Zheng

    topology of these networks, we do not need to store the adjacency matrices explicitly. Many topological properties of cube-based networks can be directly derived using their binary node labels.

    An intrinsic property of the GC is that two successive codewords differ in exactly one bit, hence the Hamming distance between successive codewords is unity. Consequently, GCs provide a simple technique to map linear arrays (or rings if the end-nodes of the sequence are adjacent) onto the cube [8]. Due to the same property, GCs also provide a convenient way of mapping multi-dimensional grids onto cube-based networks [8].

    The GC commonly encountered in the literature is the Binary Reflected Gray Code (BRGC) [9] which provides a systematic way of visiting all the nodes in the n-cube, whose labels are given in the GC sequence, and returning to the origin. The BRGC, thus, gives a solution to embedding of rings of size 2 in the n-cube. As it turns out, BRGC is not the only GC sequence which produces a Hamiltonian cycle in the n-cube. In fact, BRGC can be constructed according to the ordered set (0, 1. . II - 1) of the cube dimensions; nevertheless, any other permutation of the set {O,l,..., n - I} can produce a different sequence which also gives z Hamiltonian cycle in the cube. This was the basis for the generalization of BRGC [7] which results in n! distinct GC sequences in the n-cube. In this paper, unless otherwise specified, by GC we mean the Gray Code which yields a Hamiltonian cycle in the network. We focus on Hamiltcnian cycles in particular since we are interested in maximum size embedding of the guest graph (ring or linear array). A given GC can be uniquely represented by a sequence of node labels, or by a sequence of link labels provided that the origin is known. In [lo], a different generalization of BRGC referred to as base-h rtlflected grq codes is given in order to map linear arrays and rings onto the Generalized base-h hypercubes.

    The usefulness of conventional GCs (i.e. GCs in which two successive codewords are of Hamming distance 1) is severely restricted when applied to non-standard cube-based networks. This is because the adjacency of nodes in non-standard cubes is not necessarily conditioned upon the unity (Hamming) distance of two nodes. For instance, in an n-dimensional folded hypercube. two nodes of Hamming distance n are adjacent, but this adjacency cannot be captured by conventional GCs whose setup hinges on two successive words being of Hamming distance 1.

    In this paper, we introduce the concept of generalized GCs where two successive codewords may have a Hamming distance greater than one. It is important to note that conventional GCs can be derived from our generalized GCs, but the reverse is not true. Our unified way of characterizing GCs allows the application of this concept to the class of networks whose connectivity is specified by their binary node labels, including cube-based networks. We demonstrate this by focusing on the problem of embedding linear arrays and rings into cube-based networks. The representation of GCs here is essentially based on link labels (previous representations usually specify GCs by node labels). The link label representation provides a simple and compact way for defining the GCs in other cube-based topologies, in addition to the conventional n-cube. The rest of the paper is organized as follows. Section 2 includes the preliminaries. In Section 3, a formal description of Gray Codes is given which leads to a convenient embedding of rings into the cube-based networks. Section 4 concludes the paper.


    Let G( V, E) be a finite graph without loops or parallel edges, with the node set V(G) = Y and the edge set E(G) = E. In the text, edges are also referred to as links. When G is known from the context, the sets V(G) and E(G) will be referred to by V and E, respectively. If an edge e = (u, I) E E, then the nodes u and P are said to be adjacent and the edge e is said to be incident on these nodes.

    An n-dimensional hypercube (i.e. Qn) is a graph G( V, E), with 1 V) = N = 2, and ] E 1 = n2- . The graph G (V, E) is both node and edge symmetric. Each node in G( V, E) represents a processor and each edge represents a link between a pair of processors. Nodes are assigned binary numbers from 0 to 2 - 1 such that labels of any two adjacent nodes differ only in one bit position. Links are also labeled from 0 to (n - 1) such that link i connects two nodes whose labels differ in the ith bit, the rightmost bit position being 0. The Hamming distance between two nodes u and u,

  • The determination of Hamiltonian cycles 191

    H(u, v), is the number of links between them along the shortest path. The Hamming distance between u and u is also the number of bits in which labels of u and u differ.

    Let Z be the ternary set (0, 1, X>, where X is a dont cure symbol. Then every subcube of Q,, can be uniquely represented by a string of symbols in C. Such a string of symbols is called the label of the corresponding subcube. Each symbol in the label of a subcube corresponds to a certain dimension, starting from the rightmost symbol in the label as dimension 0. If dimension i in the label of a subcube corresponds to symbol X, then the subcube is said to span dimension i; otherwise dimension i is fixed to its corresponding symbol (i.e. 0 or 1). A k-cube contained in an n-cube (0

  • 192 Shahram Latifi and Si-Qing Zheng

    Table 1

    GCs(link labels)

    0-1-0-2-0-1-0 0-2-0-1-0-2-0 l-0-1-2-l-0-l 1-2-I-0-1-2-1 2-O-2-1-2-0-2 2-1-2-0-2-I-Z

    GCs(node labels)

    ooo,001,011.010,110,111.101.100 ooo,001,101,100,110.111,011,010 ooo,010,011,001,101,111,110,100 ooo,010,110,100,101.111,011,001 ooo, 100.101.001,011.111. 110,010 ooo. III. 101.001

    Table 2

    Ll GCs (link labels) GCs(nodelabels)

    (0, I,21 0-1-0-2-0-1-0 000,001.011,010. 110, III, 101. loo iw


    0-2-0-1-0-2-0 1-0-1-2-1-0-1 000,001.101. oao,010,011,001, loo. 110,111,011,010

    1-2-l-O-I-2-I ooo,010,110,100,101.111,011,001

    j2:I:o) 2-0-2-l-2-0-2 000.100.101,001.011.II1,110.010 2-l-2-0-2-1-2 000,100,110,010,

    (0, I,31 0-l-0-3-0-l-0 ooo,001,011.010, 101,100, 110, III II+:! 0-3-0-1-0-3-0 000,001,110, Ill. 101.100.011,010

    1g:;:yj 1-0-1-3-1-0-I 000,010.011,001,lln,1oo,101.111 1-3-1-0-1-3-1 ooo,010,101,111,110,100,011.001

    (3:l:oj 3-0-3-I-3-0-3 000,111.110,001, 3-I-3-0-3-1-3 ooo,111.101.010,011,100.110.001

    10. 2, 3) 0-2-0-3-0-2-O 000.001,101.100,011.010,110. III

    ('i, i, :1 0-3-0-2-0-3-O ooo.001,l10,111.011.010,101,100


    13: 2:o:

    2-3-2-O-2-3-2 3-0-3-2-3-O-3 2-0-2-3-2-O-2 000. 000,100,011,111.110,010.101.001 000, Ill, 100, ll0,001,101,010.011. 101.001.110,010.011, 100 III

    3-2-3-0-3-2-3 ooo,111.011,100,

    {l,2,3) l-2-l-3-l-2-l ooo.010.110.100,011.001.101,111

    I;, ;* :I I-3-1-2-1-3-1 000,010,101,111,011.001.110. loo

    (213: 1; 2-I-2-3-2-1-2 2-3-2-l-2-3-2 000, 000,100,011, 100,110,010, 111.101,001. 101,001,011.111 110,010 3-I-3-2-3-1-3 000.111,101.010,110,001,011.100 3-2-3-l-3-2-3 ooo,111.011,100,110.001,101,010

    total number of Hamiltonian cycles h(n) [some of which are not composite and therefore cannot be constructed using equations (l)-(3) for n > 31 in the n-cube is much more than n! for large n [ 1 I]. It is known that h(3) = 6 and h(4) = 1344. For general n, only bounds on h(n) are known [12]. In this paper, we adhere only to composite GC sequences due to convenience in formulation and ease of mapping. As an example, all GCs existing in a 3-cube are shown in Table 1, using both link and node representation. The starting node is assumed to be 000. Note that by specifying the origin and the sequence of dimensions, all the intermediary nodes as well as the destination node are uniquely determined. Also note that in every representation, the origin and destination are adjacent (i.e. their labels differ in one bit).

    3.2. GCs in the FHC(n) An n-dimensional folded hypercube (FHC), QL, is obtained from a Qn by connecting every pair

    of nodes of Hamming distance n in the network. The GCs in Q: may be constructed by noting that the Q[can be thought of as a Q,, with one extra dimension [3]. This extra dimension, commonly referred to as the complementary dimension,? is denoted by n. Accordingly, all complementary links (links along dimension n) are labeled n; other links are labeled as in Q,,. Thus, any set of n dimensions out of the available (n + 1) dimensions can be selected to construct a GC. But, for each selection there exist n! possible permutations yielding a total of (n + l)! possible GCs for the Qt. Hence, the following theorem holds.

    Theorem I

    There are (n + l)! distinct Hamiltonian cycles in Qr that can be identified by GCs.

    tSince every link along this dimension joins nodes with complementary labels.

  • The determination of Hamiltonian cycles 193

    As an example, all 24 GCs available in the Qf are given in Table 2. Note that dimension 3 is indeed the complementary dimension, and nodes joined by a link 3 differ in all bits (thus are neighbors in Q:).

    3.3. GCs in the Incomplete Hypercube

    An incomplete hypercube [4] with N nodes denoted by Q(N) is constructed by assigning binary labels from 0 to (N - 1) to nodes, and joining every pair of nodes with Hamming distance 1 via a link. Links in Q(N) are labeled as in Q,. When N is a power of 2, Q(N) reduces to the standard Q, (n = log, N). The major advantage of incomplete hypercubes is that they allow the inter- connection of any arbitrary number of nodes, unlike the standard cube where the number of nodes is essentially a power of 2.

    The topology of a Q(N) can be uniquely specified by the binary representation of N; we refer to this binary vector as the cube vector. Note that the cube vector is a binary n-tuple where 2- < N < 2. For instance, the Q(26) has the cube vector of 11010. Clearly, a Q(N) can be decomposed into several maximally-sized disjoint subcubes each being a standard cube. The dimensions of the subcubes obtained is independent of the way the decomposition is done, and can be obtained only from the cube vector of the Q(N). In the running example, bit positions? 4, 3 and 1 are 1 implying that the Q(26) properly contains disjoint subcubes: Q4, Q3 and Q,. In general, let b,_ , . . . b, b, be the cube vector of a Q(N). Then:

    Q(N)= UQijbi= 1, O

  • 194 Shahram Latifi and Si-Qing Zheng

    along dimension 0 in half, visit all the nodes in the first half (clearly dimension 0 is not traversed here), cross dimension 0, and visit all nodes in the second half using the path parallel to that used in the first scan in reverse order. In finding a GC sequence, however, the limitations given by Lemma 1 must be kept in mind. In addi...


View more >