Transcript
Page 1: Determination of Hamiltonian cycles in cube-based networks using generalized Gray Codes

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

DETERMINATION OF HAMILTONIAN CYCLES IN CUBE-BASED NETWORKS USING GENERALIZED

GRAY CODES?

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.

1. INTRODUCTION

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.

I89

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

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.

2. NOTATIONS AND TERMINOLOGY

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,

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

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 don’t 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 <k < n), spans k dimensions (i.e. has kXs in its label) and has (n -k) fixed dimensions. Note that the number of Xs in the label of each subcube determines its dimensionality. For instance, a subcube of a 5-cube labeled as 0X00X is of dimension 2, spans dimensions 0 and 3 and has its lst, 2nd and 4th dimensions fixed to 0. A subcube contains a node if its label matches the label of the node. For example, the above subcube contains nodes with labels 00000, 01000, 00001 and 01001.

A path originating from a node u can be uniquely specified by the labels of links composing it in the order of traversal [3]. For instance, if node u has the address 0000, the path 1-3-O originated from u, has its end-node at 1011, and passes through intermediary nodes labeled as 0010 and 1010. Two or more paths are node/link-disjoint if, except for the source and destination, they do not have any node/link in common; otherwise, the paths are called non-disjoint. Clearly a pair of node-disjoint paths are also link-disjoint, but reverse is not true.

3. GCs IN CUBE-BASED NETWORKS

Chen and Shin [9] have given a formal description of the GCs in the n-cube. Their definition yields a string of all nodes which form a Hamiltonian path in the hypercube. Hereby, we give another formal definition of GCs which is expressed as a string of link labels (as opposed to node labels), and can be applied to other cube-based networks as well.

Let ~,=(g~,g,,.. . , g,, _ , } be an ordered sequence of n distinct integers such that 0 < gi < n. Also, let q(i) = {go, g, , . . . , gi}, 0 < i < n.

Dejnition 1

Let G”n be the GC corresponding to a string rr” which includes all distinct link labels of the n-cube. Then, G”* is defined recursively as follows:

G % (0) = go (1)

G%‘.(k)=G”.(k-I)_ gk _ @‘k-l) , where 1 <k<n; and (2)

G”n = G”.(“- 1). (3)

Equation (2), in fact yields a Hamiltonian path whose end nodes are adjacent (with some exceptions for QyT as shall be seen). Appending a g, to the end of the string G*nrk-” -g, - G”n(‘-‘) will form a Hamiltonian cycle. Note that in equation (2), both sides of gk are exactly the same (one is not the reverse of the other as needed in the node-label representation of GCs). Only such GCs, often referred to as composite GCs, are the focus of our study. More specifically, GC sequences which are symmetric about their middle digit [i.e. g, in equation (2)] in their link label representation will be dealt with exclusively.

Based on the above definition, all the GCs for the cube-based networks can be constructed. After obtaining GCs, the process of embedding a ring (or linear array) of maximum size (i.e. containing N nodes) is straightforward. Simply start from any node in the host graph, follow the path given by link representation of the GC in the host network, until all the nodes are visited. In the following we briefly review the method to obtain Hamiltonian cycles in the standard cube. The non-standard cube-based networks will be addressed subsequently.

3. I. GCs in the n-cube

For the n-cube, as discussed earlier, a total of n! distinct GCs can be constructed wherein each GC corresponds to one of all possible permutations of n dimensions. It should be noted that the

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

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. 100.110.010.011. 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

/;$;l

0-2-0-1-0-2-0 1-0-1-2-1-0-1 000,001.101. oao,010,011,001,101.111.110.100 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,011.111.101.001

(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,011.100.101.010 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

[;:;:;I

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,101.010.110.001

{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.

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

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<i <n. (4)

Note that the equal sign in the above equation is rather symbolic and should not be taken literally; it simply indicates all disjoint subcubes in the Q’(N) and does not account for the extra links required to interconnect these subcubes to make up the original Q’(N). As a special case, a Q’(2”) has a binary vector of form 10” implying the proper containment of a standard Qn [i.e. Q’(2”) = Qn]. As shall be seen, identification of disjoint subcubes contained in the Q’(N) is quite instrumental in developing GCs for this network.

As discussed in the beginning of Section 3, any permutation rc of the set of dimensions existing in a standard cube specifies a GC which corresponds to a unique Hamiltonian cycle in the network. Nevertheless, for the incomplete hypercube, any ordering of dimensions cannot be used at will to construct a GC. This is true since some of the nodes in the Q’(N) do not have all n links corresponding to n dimensions. Therefore, it is imperative to devise a method which defines a Gray Code corresponding to a Hamiltonian cycle in the Q’(N). Such a Gray Cod,-, if found, will immediately provide for embedding a ring (or a linear array) of size N into the Q’(N).

Lemma I

Consider two disjoint subcubes Qk and Qj contained in the Qk with i < k. Then Qi is connected to Qk via links along dimension k only.

Proof. Let b,_,b,_,... b, 6, be the cube vector of Q’(N). The nodes of the Qk have the label b,_,b,_*. . . bk+, O,Xk, where e, means that the xth bit in the label is e, e E (0, l}, and the super- script is the repetition factor. Similarly, the nodes of Qi can be specified as b,_ , b,_ z . . . bk+, 1, b,_ , . . . bj+ , O,_V. Clearly, all nodes of Qi can only be connected to their corresponding nodes in Qk along dimension k. 0

The above lemma sheds light on the limitations involved in developing GCs for the Q’(N). As an example, consider the Q’(26) which has the cube vector 11010. This network contains subcubes Q4, Q3 and Q, . Q, is connected to Q3(Q4) along dimension 3 (4). Similarly, links along dimension 4 connect Q, to Q4. This fact implies that, in constructing a GC for the Q/(26), if we visit nodes of Q, first, the only way to go to other nodes outside Q, is via dimension 3 or 4.

To construct the GC for the Q’(N), we assume N is even when considering ring embeddingS, i.e. 6, = 0 in the cube vector. Clearly, if N is odd, embedding a ring of size N is impossible, for this implies the existence of an odd cycle in the standard cube which is not true [I]. Since 6, = 0, dimension 0 is always spanned by all disjoint subcubes of the Q’(N). The idea is to slice the Q’(N)

tThe rightmost bit position is conventionally 0. $This assumption is not necessary if embedding of a ring of size N - 1 is also acceptable.

CAEE 2 I r3--D

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

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 addition, we always start with a node belonging to the smallest disjoint cube, and traverse exactly half of its nodes before exiting the subcube. We refer to the dimension which must be crossed after visiting exactly half of the nodes of Q’(N) (0 in this case) as the bridge. We shall find it convenient to adopt the following definition.

Dejinition 2

Let ~k={go~gl~. . . , g, ._ , } be an ordered sequence of k distinct integers such that 0 < g, < k. Then we define nf’_, as follows:

Now, we are ready to give the formal description of the GC for the Q’(N) by using its cube vector. Let b,.. ,b,_, . . . 6, b, be the cube vector of the Q’(N), where n = Llog, NJ + 1. Suppose

ll,b,..., i, are all the bit positions in the cube vector such that 0 < i, < i, < . . . < i, < n and bi, = b, = . . . = 6, = 1 (Note that i, # 0 since it is assumed b, = 0.) The following sequence gives the GC which spans all the nodes in the Q’(N) forming a Hamiltonian cycle:

0 G”I’~~I_~~-G”~~~I-_ i,_..,-i,-GG, I-~-~“~~~I-,~~-~,-~“Y~-~-~,_~“~~~I, (5)

Expression 5 deserves some explanation. The bridge is dimension 0 (boldfaced and placed in the middle of the sequence). Prior to reaching the bridge, half of the nodes in every subcube must be visited. Therefore, for a subcube, say Qi, , the GC corresponding to (i, - 1) dimensions is considered (the excluded dimension is 0). If i, = 1, there will be no GC for Qi, because the only available dimension is 0 which is already used as a bridge. When going from one subcube say Qi, to another subcube, say Q,,, dimension iz is traversed since by Lemma 1 it is the only dimension which connects the aforementioned two subcubes. Observe that we could have gone from Qi, to another subcube, say Qi, by traversing dimension i,, but since we want to develop the code systematically we rather traverse dimensions in a consistently ascending (when going toward bridge) or descending (when moving away from the bridge) order. Note that the two ends of the sequence can be joined by another bridge (i.e. dimension 0) to form a Hamiltonian cycle. Also, there is no particular reason to choose 0 as the bridge. In fact, any dimension g with 0 <g < i, can be used as the bridge. This merely implies that the Q’(N) has been sliced along dimension g in which case the following generalization of expression 3 stands:

G~~1-i-iz-G?2~I-i ,-,,,- i,-G’$ l-g-G’?s’,~ _.,. -i,-G”?-l_i,-G”;“,~~. (6)

Clearly, starting from the smallest subcube Qi, , the other (r - 1) subcubes can be visited in any order in (r - i)! ways before reaching the bridge provided that Lemma 1 is not violated. Now, we can derive the number of GCs in the Q’(N) by first obtaining the number of systematic GCs and then multiplying the result by (r - l)! Systematic GCs correspond to paths which start from a mode in the smallest subcube, span half of its nodes, go to the next larger subcube, and so on until they reach the bridge, then cross the bridge and return to the smallest cube in the same order such that the two sub-paths across the bridge look exactly the same when represented by link labels. Within each subcube Q,, 1 <j < r, GCs can be written in (i, - l)! ways (recall that one dimension is reserved for the bridge). On the other hand, a total of i, bridges can be defined. Thus, the following theorem is established:

Theorem 2

There are at least K(N) distinct Hamiltonian cycles in Q’(N) which can be identified by systematic GCs where:

Example I

K(N) = i, (i, - l)!(i, - I)! . (ir - l)!(r - I)! (7)

Find the GCs for the Q’(N) with (a) N = 20, (b) N = 22, (c) N = 24, and (d) N = 336. Use dimension 0 as the bridge.

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

The determination of Hamiltonian cycles 195

Solution

(a) N = 20, cube vector = 10100, i, = 2, iz = 4. The GC sequence is:

1 -4-G”J-0-G”‘--4- I, where rr3={lt2,3}

(b) N = 22, cube vector = 10110, i, = 1, iz = 2, i3 = 4. The GC sequence is:

2-Gnl--4-Gn3-0-G”)--4-G”I-2, wheren,={l}, ~~=(1,2,3}

(c) N = 24, cube vector = 11000, i, = 3, iz = 4. The GC sequence is:

G”*-4-Gs-0-G”,--4-G”*, whererr,={1,2,3}

(d) N = 336, cube vector = 101010000, i, = 4, iz = 6, i, = 8. The GC sequence is:

G”~-6-G”~-g-G”~-~-Gx~_g_G”~-6-G”~, where

~3={1,2,3), x5=(1,2,3,4,5}, 7~7={1,2,3,4,5,6,7}.

Observe that if N = 2”, the cube vector will be: 10” and i, = i, = n. A possible GC sequence according to the above procedure will be:

G”~-I-O-G”~-I, wheren,_,={1,2,...,n-1)

which is consistent with the sequence developed for the standard cube. Also, the number of GCs according to expression (7) is n(n - l)!O! = n! which is in agreement with the previous result [9].

3.4. GCs in the Twisted Cube

An n-dimensional twisted cube [5], QT, is obtained from a Qn by substituting any two parallel links in any cycle of length 4 with two crossed links. Having a diameter of (n - l), efficient embeddability of complete binary trees, and containment of odd cycles are some of the features of this topology. The problem of developing GCs for the Qs can be trivially solved as follows. Assume that the crossed edges replaced two adjacent l-links (which are parallel and belong to a cycle of length 4) according to a given dimension labeling. Any permutation K = {i, . . .}, i # 1, i.e. a permutation which does not start with 1 will necessarily use no more than 2”-’ l-links. Thus, at least 2”-* l-links remain unused in construction of a GC which corresponds to rr. The starting node can be selected such that the substituted l-links remain unused resulting in no role for the crossed links to play. But if the permutation starts with 1, this implies that in the GC label sequence (developed for Q,) digit 1 appears in every other digit. In such a sequence, the string corresponding to the cycle with crossed edges can be easily modified to form a Hamiltonian cycle in Q,T. Figure 1 shows an example of such a case where a subsequence of . . . - 1 - 0 - 1 - . . . has changed to . . . -t’ O-t-...

h with t representing the label of crossed links. In sum, it is evident that GC

sequen es developed for Q, can be used for Q,’ as well. Furthermore, the number of distinct GCs in Qr ib the same as that in n Q .,I II. .

Fig. 1. Comparison of GC sequences in Q, and Q:.

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

196 Shahram Latifi and Si-Qing Zheng

3.5. GCs in Multiply-Twisted Cube

An n-dimensional multiply-twisted cube [13], Qyr, has the same structural complexity as does the standard cube. That is, Q,, and Q,, M7 have the same number of nodes, the same number of links, and the same degree of the node. However, recent studies [6,13,14] indicate that QrT networks have some advantages over the conventional Q, such as the smaller diameter and average distance. The formal definition of the Qn MT is as follows. We call a two-bit binary string a = a, a, as an xy pair if a, = x and a, = y, where x, 4’ E (0, 1). We say that two binary strings a = a, _ , a,, z . . . a, and b = 6, _ , b,, 2 . ho of length m (m being even) are pair-related if {u2, + , u2!, b2, + , b2i) = {00}, {lo} or{01,11),O6i<m/2.Foranodet~,inQ,M7.Ofi~2”,weuseb~~,b~_,...b~todenotethe unique n-bit binary number assigned to it. For simplicity, we also use ui to refer to its binary node label b;, , b;__ z . . b;. A Qf’is a graph of 2” nodes, each is labeled by a unique n-bit binary number such that ui and vj are connected by a link if and only if there exists a k such that:

(1) b:‘= b’, for r > k, and b; # bj for r = k; (2) if k is odd, then b; , = b: , . and b; _z . b; and b/k_* . . .bh are pair-related if k > 2; (3) if k is even, then b; ~, . . b;, and hi , bJ, are pair-related if k > 2.

The links in Qf’ are labeled such that two neighboring nodes are joined by link i if and only if the leftmost diflering bit in the nodes’ labels is in the ith position. As an example, in Qy’, nodes 000 and 001 are joined by link 0 whereas nodes 001 and 111 are joined by link 2. Figure 2 illustrates the structure of the Qy’ by contrasting it with Qn, n = 3,4. It was shown [6] that the diameter of

Q I’ is rn + l/21 , which is about half of the diameter of Q,. Also, the average distance between nodes in QyT . 1s about 3/4 of the average distance between nodes in Q, [14]. In conjunction with the regularity of QFT, these properties can be used to design simple data communication algorithms for Q/’ that are more efficient than those developed for conventional hypercubes [15].

Interestingly, the link labels for the GCs of Q, can be directly applied to Qyr in order to obtain Hamiltonian paths and cycles as shown in Table 3 for n = 3. Given a permutation 7c,

Fig. 2. Standard and multiply-twisted hypercubes.

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

The determination of Hamiltonian cycles

Table 3

GCs (link labels) GCs (node labels)

197

of {OJ,... , n - l}, the pth node label v, is obtained from the (p - 1)th node label u, by complementing the qth bit of v, and all Ith bits of v, such that 1 is odd and (I - 1)th bit is 1, where q is the (p - 1)th number in G”n. We say that a node label sequence is generated by a link label sequence G”n with respect to a node label vi if it is obtained by applying G”n to vi, which is the first (or the leftmost) node label in the node label sequence. All the node label sequences shown in Table 3 are with respect to node label v,, (or 000 in binary).

Unlike the GC node label representation of Q,, two adjacent node labels in a GC node label representation of Q:’ may differ in several bits. The following theorem states that each permutation a, corresponds to at least one unique Hamiltonian path in Q,“‘.

Theorem 3

Given any node vi, for each permutation n, of (0, 1, . . . , n - 13, there is a unique Hamiltonian path with respect to vi in Q,, MT that can be generated from node label sequence G”n.

Proof: The proof can be found in [16] and is omitted for brevity. For the Q,, any link label sequence G”n forms a Hamiltonian cycle; this is not always the case

for Q. . MT More specifically, a sequence G zn may not correspond ‘to a Hamiltonian cycle in Q,“‘. For example, two (the third and fourth ones) out of six GCs of Table 3 do not form Hamiltonian cycles. To determine whether or not a GC sequence of Q, MT forms a Hamiltonian cycle, we can simply compare the first and last node labels in the corresponding node-label sequence and check for their adjacency according to the definition of Qn MT Naturally, it is desirable to determine if a . given permutation IL, generates a Hamiltonian cycle in Q I’ or not. The following theorem provides an answer to this issue.

Theorem 4

For a permutation A, = {g,, g, , . . . , g,, _ , }, the node label sequence generated by G”n with respect to v0 forms a Hamiltonian cycle in Q. Mr if one of the following conditions holds:

(1) for eveng,_,, (a)g,_,<g,_,+ 1 and(b) ifg,_2cgn-, theng,_, is odd;

(2) for odd g,_,, (a) g,_,>g,_, or (b) O<g,_,<g,_, and g,_, is an odd number;

(3) g,-I = 1 and g,_, = 0.

Proof. See [16]. This theorem allows us to determine whether a given G”n corresponds to a Hamiltonian cycle of Q, Mr by examining only the last two numbers g, _ z and g,_ , of n,, . By Theorems 3 and 4, we can derive the following corollary regarding the number of Hamiltonian paths and cycles defined by GCs in the Qf’.

Theorem 5

The link labels G”* can generate at least n! distinct Hamiltonian paths of Q,“’ and at least n!/2 + (n - 2)! Hamiltonian cycles of Q”. 0

Proof. See [16]. In the proofs for Theorems 2-5, the power of link labels as a tool for analyzing the adjacency of node labels in Hamiltonian paths and cycles of Q,“’ are demonstrated in detail. It should be mentioned that there are more Hamiltonian paths and cycles in Q,“’ than those counted in Theorem 5. For example, applying link label sequence G”n = 2 - 0 - 2 - 1 - 2 - 0 - 2, where n, = { l,O, 2}, to node label 010, we can obtain a node label sequence (010, 110, 111, 001, 011, 101, 100, 000). This Hamiltonian path of Qy’ is not identical to any one listed in Table 3. Furthermore, this path can be extended to a Hamiltonian cycle of Qy’ that is not listed in Table 3.

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

198 Shahram Latifi and Si-Qing Zheng

4. CONCLUSION

We introduced a new generalization of GCs which is applicable to many networks whose connectivities are based on the relationship of binary node labels, including cube-based networks. The link label representation of binary reflected gray codes is employed to identify the gray code sequence for such cube-based architectures as: standard n-cube, folded hypercube, incomplete hypercube, twisted hypercube and multiply-twisted hypercube. The primary application of the results obtained is the optimal embedding of rings into mentioned networks, which in turn allows the portability of parallel algorithms designed for ring (or linear array) topologies onto the cube. We believe that our generalized GCs can be used to solve many other network problems such as: embedding, and fault-tolerant routing.

The work can be extended in two possible dimensions. First, embedding of 2-D and multi- dimensional meshes onto the cube-based architectures using the Gray Code may be investigated (the work has already been done rather extensively for the n-cube). Second, finding the set of Link-Disjoint Hamiltonian Cycles (LDHCs) in the cube-based networks can be researched The latter avenue has applications in fault-tolerant routing and is almost intact, although for the standard cube, it has been claimed [17] that there exist Ln/2 J LDHCs in the Qn. Note that according to this result, for even n, all the links of the Qn are used in construction of LDHCs. Based on this result, we conjecture the number of LDHCs to be L(n + 1)/2 _I for QI, Lm/2J for Q!, (2m being the minimum degree of the node), and Ln/2J for Ql and Q/r.

1. 2.

3. 4. 5.

6.

7.

8.

9.

10.

II.

12.

13. 14.

15.

16.

17.

REFERENCES Y. Saad and M. H. Schultz, Topological properties of hypercubes. IEEE Trans. Computers 37, 8677872 (1988). G. B. Adams and H. J. Siegel, The extra stage cube: a fault-tolerant interconnection network for supersystems. IEEE Trans. Computers 31, 443-454 (1982). S. Latifi and A. El-Amawy, On folded hypercubes. Proc. 1989. Im. Conf. Parallel Processing 1, 180-187 (1989). H. P. KatsetT, Incomplete hypercubes. IEEE Trans. Compufers 37, 6044608 (1988). A. H. Esfahanian, L. M. Ni and B. E. Sagan, The twisted n-cube with application to multiprocessing. lEEE Trans. Compulers 40, 88-93 (1991). K. Efe, P. Blackwell, T. Shiau and W. Slough, A reduced diameter interconnection network. Department of Computer Science, Univ. of Missouri, Colo. (1988). L. N. Bhuyan and D. P. Agrawal, Generalized hypercube and hyperbus structures for a computer network. IEEE Trans. Computers C-33, 323-333 (1984). S. L. Johnsson. Communication efficient basic linear algebra computations on hypercube architectures. J. Parallel Distributed Computing 4, 1333172 (1987). M. S. Chen and K. G. Shin, Processor allocation in an n-cube multiprocessor using gray codes. IEEE Trans. Computers C-36, 139661407 (1987). S. Lakshmivarahan and S. K. Dhall, Anai.vsis and Design @‘Parallel Algorithms, pp. 73382. McGraw~Hill, New York (1990). K. Efe, Programming the twisted-cube architectures. Proceedings of fhe 9th IEEE Imernational Conjerence on Distributed Computing Systems, Newport Beach, pp. 254.-262 (5 9 June 1989). E. Dixon and S. Goodman, On the number of Hamiltonian circuits in the n-cube. Proc. Am. Mulh. Sot. 50, 500-504 (1975). K. Efe, The crossed cube architecture for parallel computation. IEEE Trans. Parallel Distributed Systems. In press. G. Young and S.-Q. Zheng, Average distance between vertices in multiply-twisted hypercubes. Technical Report #91-001, Dept of Computer Science, LSU. Baton Rouge, Louisiana. Presented at the 22nd Inr. Conf. Combinatorics, Graph Theory and Computing (1991). S.-Q. Zheng, SIMD data communication algorithms for multiply-twisted hypercubes. Proc. 5th Int. Parallel Processing Symposium (I 991). S. Q. Zheng and S. Latiti, Optimal simulation of linear array and ring architectures on multiply-twisted cube using generalized gray codes. IEEE Trans. Parallel und Distribured Systems. In press, M. Y. Chan and S. J. Lee, Distributed fault-tolerant embeddings of rings in hypercubes. J. Parallel Disfribured Compufing 11, 63-71 (1991).

Authors’ Biographies on p. 199

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

The determination of Hamiltonian cycles 199

AUTHORS’ BIOGRAPHIES

Shahram LatIB received the Master of Science degree in Electrical Engineering from the University of Teheran, Iran in 1980. He received Master of Science and Ph.D. degrees both in Electrical and Computer Engineering from Louisiana State University, Baton Rouge in 1986 and 1989, respectively. He is currently an Associate Professor of Electrical Engineering at University of Nevada at Las Vegas. From 1980 to 1984 he worked as a Technical Manager in Khazar Company, Teheran, Iran. His research interests include computer architecture, fault tolerant computing, parallel processing, and interconnection networks. Dr Latifi is a senior member of IEEE and a member of IEEE Computer Society.

S. Q. Zheng is an Associate Professor of Computer Science, and adjunct Associate Professor of Electrical and Computer Engineering at Louisiana State University, Baton Rouge. He received the B.S. degree from Jilin University, China in 1973. He received the M.S. degree in mathematical sciences from the University of Texas at Dallas in 1982, and the Ph.D. degree in computer science from the University of California at Santa Barbara in 1987. Dr. Zheng’s research interests include VLSI, parallel and distributed computing, algorithms, and computational geometry.


Recommended