each 2-dimensional grid can be embedded into its optimal hypercube with edge- ... of H and therefore can be embedded with edge-congestion and dilation 1 ...
Parallel Processing Letters, Vol. 8, No. 2 (1998) 231{242 cfWorld Scienti c Publishing Company
EMBEDDING 2-DIMENSIONAL GRIDS INTO OPTIMAL HYPERCUBES WITH EDGE-CONGESTION 1 OR 2 MARKUS ROTTGER and ULF-PETER SCHROEDER Department of Mathematics and Computer Science, University of Paderborn, D-33102 Paderborn, Germany Received January 1997 Revised May 1998 Accepted by A. M. Farley & A. Proskurowski ABSTRACT This paper explores one-to-one embeddings of 2-dimensional grids into hypercubes. It is shown that each 2-dimensional grid can be embedded with edge-congestion 2 into its optimal hypercube (the smallest hypercube with at least as many nodes as the grid). Additionally, a technique is developed to embed many 2-dimensional grids into their optimal hypercubes with edge-congestion 1. Keywords : embedding, 2-dimensional grid, hypercube, edge-congestion.
1. Introduction
Let G = (V; E) and H = (V 0 ; E 0) be nite graphs. An (one-to-one) embedding of G into H is an injective function f : V ?! V 0 together with a routing scheme Rf which assigns to each edge e = fv1 ; v2g 2 E a path in H from f(v1 ) to f(v2 ). G is called the guest graph and H is called the host graph. The congestion of an edge e0 2 E 0 is the number of paths in fRf (e) j e 2 E g containing e0 as an edge. The edge-congestion of an embedding is the maximum congestion of the edges of E 0 . The dilation of an edge e 2 E is the length of the path Rf (e), the dilation of an embedding is the maximum length of the paths in fRf (e) j e 2 E g. An important problem in graph embeddings and parallel computing is to embed 2-dimensional grids into hypercubes. The 2-dimensional x1 x2 grid is the graph (V; E) with V = f(a1; a2) j 0 ai < xi g and E = ffe1 ; e2g j e1 ; e2 2 V; e1 and e2 dier by one exactly in one entryg. A torus is an x y grid with additional wraparound edges. The hypercube of dimension k, denoted by Q(k), is the graph (V; E) with V = f0; 1gk and E = ffe1 ; e2g j e1 ; e2 2 V , H(e1 ; e2 ) = 1g, where H is the Hamming distance, i.e. the number of entries where the corresponding sequences dier. In this paper, we only consider embeddings of the x y grid into the smallest hypercube with at least xy nodes, which is called the optimal hypercube for the x y This
work was supported by the DFG-Sonderforschungsbereich 376 \Massive Parallelitat: Algorithmen, Entwurfsmethoden, Anwendungen" and the EC ESPRIT Long Term Research Project 20244 (ALCOM-IT). 231
2 Markus Rottger & Ulf-Peter Schroeder
grid. Note that the optimal hypercube for the x y grid is of dimension dlog(xy)e, where log denotes the logarithm based on 2. Among others, embedding a guest graph into a host graph is used to model the problem of processor allocation in a distributed system. The guest graph represents a distributed algorithm, with nodes representing processes and edges representing interprocess communication. The host graph represents a distributed system, with nodes representing processors and edges representing communication links. Since many distributed algorithms can be modeled by 2-dimensional grids and the architecture of several currently used distributed systems bases on the hypercube (e.g. Intel iPSC, NCube, and Connection Machine), the problem of embedding 2-dimensional grids into hypercubes is of high interest. The most important costmeasures to rate the quality of embeddings are the edge-congestion, i.e. the amount of possible contention in the distributed system for the same link, and further the dilation, i.e. the distance between communicating processes in the distributed system. In the related literature, the dilation of such embeddings has been discussed intensively. In [1,2,3,4] it is shown that each 2-dimensional grid can be embedded into its optimal hypercube with dilation 2, the least possible dilation in general. Embeddings of multidimensional grids into their optimal hypercubes with minimized dilation are examined in [2,5,6,7,8,9]. The dilation of embeddings of 2-dimensional grids into hypercubes with fewer nodes than the grid is explored in [10]. Modern distributed systems have special routing chips, i.e. non neighboring processors can communicate without in uencing other processors. Since the communication performance of a distributed system is still limited, the edge-congestion is the most important criterion of measuring the quality of an embedding (cf. [11]). In [12] the complexity of embedding arbitrary graphs into hypercubes with edgecongestion 1 is considered. The authors proved that the problem to determine whether an arbitrary graph can be embedded into its optimal hypercube with edgecongestion 1 is NP -complete. In [3] and independently in [13], it is shown that each 2-dimensional grid can be embedded into its optimal hypercube with edgecongestion 5 and dilation 2. In this paper, we present methods to decrease the edge-congestion of such embeddings. The paper is organized as follows: In Sect. 2, we present a technique providing embeddings of each 2-dimensional grid into its optimal hypercube with edgecongestion 2. In Sect. 3, we show how to decrease the edge-congestion down to 1 for a particular class of grids and study how often this technique is applicable. Some open problems are listed in Sect. 4.
2. Embedding with Edge-Congestion 2 In this section, we present a technique for embedding 2-dimensional grids into their optimal hypercubes with edge-congestion 2. This technique can be applied to map nodes of an arbitrary x y grid G as the guest graph onto the nodes of H = Q(dlog(xy)e) as the host graph.
Embedding 2-dimensional Grids into optimal Hypercubes . . . 3
If G is a subgraph of H, i.e. if and only if dlog(xy)e = dlog xe + dlog ye holds (see [14]), we use a concatenation of the binary re ected Gray code to embed G into H. The k-bit binary re ected Gray code Gk = fGk (0); : : :; Gk(2k ? 1)g is recursively de ned as G1 = f0; 1g, Gk+1 = f0Gk (0); 0Gk(1); : : :; 0Gk (2k ?1); 1Gk (2k ? 1); : : :; 1Gk(1); 1Gk(0)g. To map the nodes of G onto the nodes of H we de ne a function fsub as follows: For a node (x0 ; y0 ) of the x y grid set fsub (x0 ; y0 ) = Gdlog xe (x0) Gdlog ye (y0 ); where represents the concatenation of the corresponding strings. Obviously, Gk (i) and Gk (i + 1), for i 2 f0; : : :; 2k ? 2g, dier just in one bit and Gk (i) 6= Gk (j) if i 6= j for any i; j 2 f0; : : :; 2k ? 1g. Therefore, fsub is an injective function providing edge-congestion and dilation 1. In the following let us assume that G is not a subgraph of H, i.e. dlog(xy)e = dlog xe + dlog ye? 1. In particular this means that neither x nor y is a power of two. Note that we can assume without loss of generality that x 23 2blog xc holds. (If x > 23 2blog xc and y > 23 2blog yc we can conclude that xy > 98 2dlog(xy)e ). We embed G into an a b torus T with a = 2blog xc and b = 2dlog ye . Note that T is a subgraph of H and therefore can be embedded with edge-congestion and dilation 1 into H. Thus, embedding G into T provides an embedding of G into H. Let us explain the embedding into a torus by using an example: The 6 5 grid as the guest and the 4 8 torus as the host. We align the torus in the grid compressing each row of the torus. This compression is shown in Fig. 1(a). Note that each row of the torus (called chain ) can be described by a vector of length 5, e.g. vectors (2; 1; 2; 1; 2) and (1; 2; 1; 2; 1) correspond to chain 0 and 1, respectively. The jth element, 0 j < 5, of each vector determines how many nodes of the corresponding chain are aligned in the jth column of the grid. Node number 0 of chain 1 and node number 1 of chain 3 are not shown in Fig. 1(a), since they are not images of any node of the 6 5 grid. Note that we can construct an embedding of a grid into a torus by de ning an embedding matrix (i.e. the above mentioned vectors must be de ned) and by de ning how the elements of each chain are connected. Additionally, a routing scheme must be de ned. Now we describe the set-up of the embedding matrix. In fact, this set-up is very easy to compute. We de ne the embedding matrix W = (wij ) for all i; j with 0 i < a; 0 j < y as follows: i + j + 1 i + j ? x a : wij = x a Hence, for x = 6, y = 5, a = 4, and b = 8 we get the embedding matrix
02 1 2 1 21 B 1 2 1 2 1 CC : W =B @2 1 2 1 2A 1 2 1 2 1
4 Markus Rottger & Ulf-Peter Schroeder 0 chain 0 chain 1
1 1 1
chain 2 chain 3
2 2
2 2 3 3 3 4
3 4 4 4 5 5
5 5 6 6 6 7
6 7 7 7 0 0
(a)
(b)
Fig. 1. Embedding of the 6 5 grid into the 4 8 torus, the chain alignment (a) and routing scheme (b). Note that the torus is aligned in the grid.
Lemma 1 The embedding matrix W has the following properties: (a) wij 2 f1; 2g for 0 i < a; 0 j < y, P (b) jy? wij b for 0 i < a, P (c) ia? wij = x for 0 j < y, 1 =0
1 =0
(d) there are no consecutive 2's in any row or column of W .
Proof. (a) Using d km+l e ? d ml e 2 fb mk c; d mk eg for any integers k, l, and m, it follows that wij = dx i+ja+1 e ? dx i+a j e 2 fb ax c; d xa eg = f1; 2g. (b) Note that Pfor a partial sum in a row r 2 f0; : : :; a ? 1g of the matrix W one has: lj =k wrj = dx r+al+1 e ? dx r+a k e, 0 k l < y. Therefore, Py?1 w = dx i+y e ? dx i e d xy e = d(xy)=2blog xce 2dlog ye. j =0 ij a a a (c) One similarly to (b) compute a partial sum in a column c 2 f0; : : :; y ? 1g: P Pl can a ? k +c l +c+1 x a e, 0 k l < a. Thus, i=01 wij = dx a+a j e? i=j k wic = dxxj a e?d dx a e = x + d a e ? d xja e = x. (d) We must show that wij + wij +1 3 and wij + wi+1j 3 hold. Since still x 32 2blog xc = 32 a holds, we get: wij + wij +1 = wij + wi+1j = dx i+ja+2 e ? dx i+a j e d 2ax e d 26aa e = 3 2. Now we have to de ne how the elements of each chain are connected. We do this de ning a numbering within each chain, using the following agreement: We consecutively number the elements of each chain modulo b from left to right. Two elements of the same chain that are assigned to the same column of the grid are numbered from the top to the bottom. The leftmost, topmost element of the rst
Embedding 2-dimensional Grids into optimal Hypercubes . . . 5
chain is numbered with 0. The leftmost, topmost element of chain i is numbered the same as the leftmost, bottommost element of chain i ? 1. Figure 1(a) is designed in accordance with this agreement. Now we are able to de ne the function fT that maps the nodes of the x y grid onto the nodes of the a b torus. In order to do that, we formalize the agreement mentioned above. Let (x0 ; y0 ) be a node of the x y grid. We set fT (x0 ; y0 ) = (a0 ; b0) with a0 and b0 de ned as:
(
(1)
1 0a ? yX ? X b0 = @ wi ? a0 + wa j + A mod b;
(2)
a ~
i=0
and
)
X a0 = min a~ 2 f0; : : :; a ? 1g j wiy > x0 ; 0
0
1
i=0
0
0
1
j =0
0
P
where mod denotes the modulo operator and = 1, if x0 ? 1 = ai=0?1 wiy , and = 0, otherwise. For each node (x0; y0 ) of the grid, the variable a0 determines the number of the chain, while b0 corresponds to the position within this chain (see Fig. 1(a)). To complete the embedding into the torus we de ne a routing scheme. We denote this routing scheme by RT . Note that each vertical edge f(x0; y0 ); (x0 + 1; y0)g of the grid can be routed using a single edge of the torus, i.e. ffT(x0 ; y0 ); fT (x0 + 1; y0 )g is an edge of the torus. Let f(x0 ; y0 ); (x0; y0 + 1)g be an arbitrary horizontal edge of the grid. We set fT (x0; y0 ) = (a0; b0) and fT (x0; y0 + 1) = (a00; b00). At rst we use the shortest path from (a0; b0) to (a0; b00), i.e. we utilize the edges belonging to the chain numbered with a0 in increasing order in accordance with the numbers assigned within the chain. An examination of (1) and (2) shows that ja0 ? a00j 1. If a0 6= a00, we use the edge f(a0; b00); (a00; b00)g of the torus connecting chain No. a0 with chain No. a00. Otherwise, we already have reached the node (a00; b00). Figure 1(b) shows the routing scheme RT by an example. Lemma 2 The function fT and the routing scheme RT de ne an embedding of an x y grid into a 2blog xc 2dlog ye torus with edge-congestion of at most 3 and dilation of at most 3.
0
0
Proof. Properties (b) and (c) of Lemma 1 ensure that fT is an injective function, since each node of the grid is mappedPto a uniquePnode of the torus. The P embedding matrix has the property, that j ki=0 wij ? ki=0 wij j 1 and j kj=0 wij ? Pk w j 1. Thus, it is easy to see that each vertical edge has dilation 1 and j =0 i j each horizontal edge is stretched to at most 2 edges belonging to a chain and at most one edge connecting two chains. Therefore, the dilation is at most 3. Examining the routing scheme, it can be shown that each vertical edge of the torus, i.e. an edge connecting elements with the same number of consecutive chains, is used at most twice. A horizontal edge of the torus, i.e. an edge connecting consecutive elements within a chain, is used to route at most two horizontal grid edges and one vertical grid edge. Thus, the edge-congestion is at most 3 2. 0
0
6 Markus Rottger & Ulf-Peter Schroeder
Since the above considered a b torus, with a = 2blog xc and b = 2dlog ye , is a subgraph of the optimal hypercube for the x y grid, the embedding of the grid into the hypercube is straightforward. We de ne the function fec2 that maps the nodes of the x y grid onto the nodes of the hypercube Q(dlog(xy)e) as follows: For a node (x0 ; y0 ) of the x y grid we set fec2(x0 ; y0 ) = Glog a (a0) Glog b (b0); where (a0; b0) = fT (x0; y0 ): To complete the embedding we de ne a routing scheme, that we denote by Rec2. 1. Routing vertical edges of the grid. Since for all vertical edges f(x0; y0 ); (x0 +1; y0 )g of the grid, ffT (x0; y0 ); fT (x0 + 1; y0)g is an edge of the a b torus, such grid edges can be routed using a single edge of the hypercube, i.e. ffec2(x0 ; y0 ); fec2(x0 +1; y0 )g is an edge of the hypercube. 2. Routing horizontal edges of the grid. Let f(x0; y0 ); (x0; y0 + 1)g be an arbitrary horizontal edge of the grid. We set fec2(x0 ; y0 ) = s and fec2(x0 ; y0 + 1) = d. As shown above, fT has dilation of at most 3. Therefore, H(s; d) 3 and we can set: s = hdlog(xy)e?1 hl hm hn h0 ; d = hdlog(xy)e?1 hl hm hn h0 ; with dlog(xy)e > l m n 0 and hi 2 f0; 1g. We use the following path from s to d: s ! hdlog(xy)e?1 hl hm hn h0 ! hdlog(xy)e?1 hl hm hn h0 ! d Figure 2 shows the function fec2 and the routing scheme Rec2 by an example. Theorem 1 The function fec2 and the routing scheme Rec2 de ne an embedding of an x y grid into Q(dlog(xy)e) with edge-congestion of at most 2 and dilation of at most 3.
Proof. Since the Gray code and f are injective functions, f is injective, too. T
ec2
Additionally, fec2 has the same dilation as fT . Using the above de ned routing scheme, three dierent kinds of hypercube edges are utilized to route the grid edges: () Glog a (a0 ) Glog b (b0 ) | Glog a (a0 + 1) Glog b (b0 ) ( ) Glog a (a0 ) Glog b (b0 ) | Glog a (a0 ) Glog b((b0 + 1) mod b)
( ) Glog a (a0 ) Glog b (b0 ) | Glog a (a0 ) Glog b((b0 + 3) mod b) if the least signi cant bits of Glog b (b0 ) and Glog b ((b0 + 3) mod b) are equal.
Embedding 2-dimensional Grids into optimal Hypercubes . . . 7 000
chain 00 chain 01
001
000
001
001
chain 11 chain 10
011
001
011
011
011
010
010
010
110
010
111
110
110
111
101
110
101
111
111
101
100
101
100
100
100
000
000
Fig. 2. Embedding of the 6 5 grid into Q(5), the chain alignment (left) and routing scheme (right).
Obviously, () and ( ) are hypercube edges, since the path induced by the Gray code is Hamiltonian. It can be easily derived from the de nition of the Gray code that ( ) is an edge of the hypercube. Edges of type () and ( ) are used at most twice, edges of type ( ) only once. We show this by an examination of all possible scenarios. In the following we omit the modulo operator, i.e. b00 = b0 + j is used to abbreviate b00 = (b0 + j) mod b. Let us rst consider the horizontal grid edges. We consider a node (x0; y0 ), with fT (x0 ; y0 ) = (a0 ; b0), and its horizontal neighbor, the node (x0 ; y0 + 1), with fT (x0 ; y0 + 1) = (a00; b00). 1. a00 = a0 and b00 = b0 + 1. One hypercube edge of type ( ) is used. See scenario 1 in Fig. 3. 2. a00 = a0 and b00 = b0 + 2. (a) If Glog b (b0) and Glog b (b0 + 1) dier in their least signi cant bits, two edges of type ( ) are used. The two possible scenarios are shown in Fig. 3, scen. 2a. (b) If the least signi cant bits of Glog b(b0 ) and Glog b (b0 + 1) are equal, one edge of type ( ) and one edge of type ( ) are used. The two possible scenarios are shown in Fig. 3, scen. 2b. 3. a00 = a0 ? 1 and b00 = b0 + 2. (a) If Glog b (b0 ) and Glog b (b0 +1) dier in their least signi cant bits, two edges of type ( ) and one edge of type () are used. The scenario is shown in Fig. 3, scen. 3a. (b) If the least signi cant bits of Glog b(b0 ) and Glog b (b0 + 1) are equal, one edge of type ( ), one of type ( ), and one of type () are used. The two possible scenarios are shown in Fig. 3, scen. 3b.
8 Markus Rottger & Ulf-Peter Schroeder b’
b’+1
torus edges
chain a’
routing scheme
scenario 1 b’+1
b’
b’−1
b’+2
chain a’
chain a’ b’−1
b’
b’+1
b’+2 scenarios 2a b’+1
b’+2 chain a’
b’ b’−1
chain a’ b’−1
b’
b’+2
b’+1
scenarios 2b b’
b’+1
b’
chain a’’
b’+1
b’−1
b’
b’−1
b’
b’+1
chain a’’ b’
b’−1
chain a’
b’+2
b’
chain a’’
b’+2
chain a’
b’+2
chain a’ b’+1
b’+2
b’−1
b’+1
b’+1
b’+2
scenario 3a
b’+2
scenarios 3b
b’+1
b’
b’ chain a’ chain a’
chain a’
chain a’’ b’
b’+1
scenario 4
chain a’’ b’+1 scenario 5
b’ scenario 6
Fig. 3. All possible scenarios for routing grid edges according to the routing scheme Rec2.
4. a00 = a0 + 1 and b00 = b0 + 1. One edge of type ( ) and one edge of type () are used. The corresponding scenario is shown in Fig. 3, scen. 4. Let us now examine the vertical grid edges. We consider a node (x0 ; y0 ), with fT (x0; y0 ) = (a0 ; b0), and its vertical neighbor, the node (x0 + 1; y0 ), with fT (x0 + 1; y0 ) = (a00; b00). 5. a00 = a0 and b00 = b0 + 1. One hypercube edge of type ( ) is used. See scenario 5 in Fig. 3. 6. a00 = a0 + 1 and b00 = b0 . One hypercube edge of type () is used. See scenario 6 in Fig. 3.
Embedding 2-dimensional Grids into optimal Hypercubes . . . 9
Since according to Lemma 1(d) there are no consecutive 2's in any row or column of the embedding matrix, it is guaranteed that all possible cases are considered. Combining all these scenarios, it is easy to see that the congestion of the edges of type () and ( ) is at most 2 and the congestion of the edges of type ( ) is at most 1. Let us, for example, assume that a coincidence of the scenarios 2a, 3a, and 5 yields to congestion 3 of an edge of type ( ). It follows that Glog b (b0) and Glog b (b0 + 1) dier in their least signi cant bits (see Fig. 3, the rst scenario of 2a). Additionally, according to case 3a, Glog b (b0 +1) and Glog b (b0 +2) dier in their least signi cant bits. Thus, Glog b (b0) = Glog b(b0 + 2) follows, which is a contradiction, since the path induced by the Gray code is Hamiltonian. Similarly, assuming edgecongestion greater than 2, we can derive a contradiction considering any two or more combinations of the above listed scenarios 2.
3. Embedding with Edge-Congestion 1
In this section, we describe a technique for embedding a subclass of the 2dimensional grids into their optimal hypercubes with edge-congestion 1. We assume again that the guest grid is not a subgraph of its optimal hypercube. Using this technique, the grid is split into two parts and each of them is embedded into the hypercube with edge-congestion and dilation 1. The cut-edges connecting these two parts are routed utilizing as yet unused edges of the hypercube. Theorem 2 There exists an embedding of the x y grid into Q(dlog(xy)e) with edge-congestion 1, if x 8, y 16, and blog yc (3) log x + log 2yd?log2xe ? x blog yc: Proof. To embed G = x y into its optimal hypercube H = Q(dlog(xy)e), we rst divide the grid G into the two parts G1 = x 2blog yc and G2 = x y ? 2blog yc , i.e. G1 = f(x0; y0 ) j y0 < 2blog yc g, G2 = f(x0; y0 ) j y0 2blog yc g. Then we map each node (x0; y0 ) of G onto the nodes of the intermediate grid Gint = 2dlog xe 2blog yc as follows: fint (x0; y0 ) = (a0 ; b0); with a0 = x0 and b0 = y0 , if (x0; y0 ) is a node of G1 , and otherwise we de ne: a0 = b0 =
(
(
x + (y0 ? 2blog yc ) mod (2dlog xe ? x) if b y2 ?log2 x ?x c is even, d log xe 0 b log y c d log xe 2 ? 1 ? (y ? 2 ) mod (2 ? x) otherwise, 0
d
blog
yc
e
b y x??22loglogyx?1 c + x0 2dlogd(y?2 log y )=(2 log x ?x)ee if x0 is even, log y log y log x (x0 + 1) 2dlogd(y?2 )=(2 ?x)ee ? 1 ? b y x??22 log x?1 c otherwise. 0
b
c
d
b
c
d
e
e
b
c
d
e
0
b
c
d
e
At rst glance, the de nition of fint for nodes of G2 seems to be very complicated, but it only de nes a \snake-like" embedding of the rows of G2 into the \bottom part" of the grid Gint . Figure 4 shows this embedding by an example with G = 13 37 and Gint = 16 32. Note that this time we aligned the guest graph into the host
10 Markus Rottger & Ulf-Peter Schroeder 0 1 2 3 4 5 6 7 8 9 10 11 12 0
1
2
3
4
5
6
7
8
9
10
11 12
Fig. 4. Embedding the 13 37 grid G into the 16 32 grid Gint . For simplicity, only the rows of
G are shown.
1. Hamiltonian cycle 2. Hamiltonian cycle
Fig. 5. Two edge-disjoint Hamiltonian cycles in Q(4), which is isomorphic to the 4 4 torus.
graph and not vice versa (in contrast to Sect. 2). For simplicity, only the rows of G except the edges connecting G1 with G2 are shown. To rout the edges separating G1 and G2, each rightmost node in one of the top 13 rows must be linked with the image of the rst node in one of the 13 rows of G2 (aligned in the bottom part of Gint ). In Fig. 4 we have labeled the corresponding nodes with the same number. Note that Gint is a subgraph of H and therefore can be embedded with edgecongestion and dilation 1 into H. Thus, embedding G into Gint provides an embedding of G into H. To ensure that the cut-edges can be routed utilizing as yet unused hypercube edges, we use the fact, that there exist at least two edge-disjoint Hamiltonian paths in Q(k), for k 4. (In fact, as shown in [15], there exist exactly b k2 c edge-disjoint Hamiltonian cycles in Q(k)). Figure 5 shows two edge-disjoint Hamiltonian cycles in Q(4). In the following, let us denote by Pk = Pk (0) ! Pk (1) ! ! Pk (2k ? 1) the rst path (without the wrap-around edge) and by Pk0 = Pk0 (0) ! Pk0 (1) ! ! Pk0 (2k ? 1) the second path of the two edge-disjoint Hamiltonian paths in Q(k), k 4. To map each node (x0 ; y0 ) of G onto a unique node of the hypercube, we set
(
Pdlog xe (a0 ) Pblog yc (b0 ) if (x0 ; y0 ) is a node of G1; Pdlog xe (a0 ) Gblog yc (b0) if (x0 ; y0 ) is a node of G2; where (a0 ; b0) = fint (x0 ; y0 ) and Gk is the above de ned k-bit binary re ected Gray code. The construction of fint and Gk provides that in H the image of each node fec1(x0 ; y0 ) =
Embedding 2-dimensional Grids into optimal Hypercubes . . . 11
(x0; y0 ) of G2 is in distance 1 to the image of the node (x0 + 1; y0 ) of G2. In other words, row x0 of G2 is aligned in a parallel fashion in H to row x0 + 1 of G2 . To ensure this, we use the following property of the Gray code, that can be easily derived from its de nition.
H(Gk (l); Gk (2k ? l ? 1)) = 1 for all k; l with 0 l < 2k ? l ? 1: To exploit this fact, we align each of the x rows of G2 in 2dlogd(y?2 log y )=(2 log x ?x)ee columns of Gint . Therefore, it must hold: b
x (2dlog xe ? x) 2dlogd(y?2
blog
y c )=(2dlog xe
c
d
e
?x)ee (2dlog xe ? x) 2blog yc ;
which is equivalent to Eq. (3). In addition, since the path Pk and the path induced by Gk are Hamiltonian, the function fec1 embeds G1 and G2 with dilation 1 into H. Hence, it remains to route the cut-edges, i.e. the edges connecting G1 with G2 . We can route these edges using the path Pk0 , since up to now we have been exploiting in each subcube S of H only the edges of the path Pk , where S is induced by the images of the nodes in a single row or column of G1 . Note that the images in H of the nodes in a single column of G1 de ne a unique subcube of dimension dlog xe. Consider for example Fig. 4. The image of the rightmost node vi in row i of G1, 0 i 12, must be linked with the image of the rst node vi0 in row i of G2 . In Fig. 4 we have labeled the corresponding nodes vi and vi0 with the same number. Note that there exists a unique hypercube node hi that is a node of the subcube Hi of dimension 5 induced by the images of the nodes in row i of G1 as well as a node of the subcube Hi0 of dimension 4, which is the host of the node vi0 and which is induced by the images of the nodes in a single column of G1 . At rst we connect the image of vi with the node hi using the edges of P50 in the subcube Hi . Then we use the edges of P40 in the subcube Hi0 to link hi with the image of the node vi0 . Therefore we can guarantee that each edge of the hypercube is used at most once to route the edges of G. In general, the routing of the cut-edges can be constructed analogously, if the x y grid satis es inequality (3). Additionally, x 8 and y 16 must hold, since each of the above mentioned subcubes S must be of dimension greater or equal than 4 to guarantee that there exist two edge-disjoint Hamiltonian paths in the above mentioned subcubes S 2. To study how often the above developed embedding technique is applicable, we have examined all 2-dimensional grids that are subgraphs of the 215 215 grid. There exist more than 500 billion dierent 2-dimensional grids of this kind. Only 61% of them are subgraphs of their corresponding optimal hypercubes, the function fec1 is applicable for 17%. Thus, 78% of the considered grids can be embedded with edge-congestion 1. As shown before, the remaining 22% are embeddable with edge-congestion of at most 2.
12 Markus Rottger & Ulf-Peter Schroeder
4. Open Problems Do there exist grids that cannot be embedded with edge-congestion 1 into their optimal hypercubes? In particular, what about the 3 5 grid? The x y grid has O(xy) edges. Its corresponding optimal hypercube has O(xy log(xy)) edges, i.e. many more edges than the grid for large x; y. Is it true, that there always exists an embedding of the x y grid into its optimal hypercube with edge-congestion 1 if x; y c for some c large enough? Is it possible to embed any 2-dimensional grid into its optimal hypercube with edge-congestion and dilation of at most 2?
References [1] M.Y. Chan, Dilation-2 embeddings of grids into hypercubes, in Proc. Inter. Conf. on Parallel Processing, St. Charles, IL, 1988, 295{298. [2] M.Y. Chan, Embedding of grids into optimal hypercubes, SIAM J. Computing 20, No. 5, (1991) 834{864. [3] M.Y. Chan and F.Y.L. Chin, A parallel algorithm for an ecient mapping of grids in hypercubes, IEEE Trans. on Parallel and Distributed Systems 4, No. 8, (1993) 933{946. [4] S.-H.S. Huang, H. Liu, and R. Verma, A new combinatorial approach to optimal embeddings of rectangles, Algorithmica 16 (1996) 161{180. [5] S. Bettayeb, Z. Miller, T. Peng, and I.H. Sudborough, Embedding k-D meshes into optimum hypercubes with dilation 2k ?1, in Proc. of the 1st Canada-France Conference on Parallel Computing, LNCS 805, Springer, 1994, 73{80. [6] M.Y. Chan, F.Y.L. Chin, C.N. Chu, and W.K. Mak, Dilation-5 embedding of 3dimensional grids into hypercubes, Journal of Parallel and Distributed Computing 33 (1996) 98{106. [7] C.T. Ho and S.L. Johnsson, Embedding meshes in boolean cubes by graph decomposition, Journal of Parallel and Distributed Computing 8 (1990) 325{339. [8] H. Liu and S.-H.S. Huang, Dilation-6 embeddings of 3-dimensional grids into optimal hypercubes, in Proc. Inter. Conf. on Parallel Processing, 1991, 250{254. [9] M. Rottger, U.-P. Schroeder, and W. Unger, Embedding 3-dimensional grids into optimal hypercubes, in Proc. of the 1st Canada-France Conference on Parallel Computing, LNCS 805, Springer, 1994, 81{94. [10] Z. Miller and I.H. Sudborough, Compressing grids into small hypercubes, Networks 24, No. 6, (1994) 327{358. [11] B. Monien, R. Luling, and F. Langhammer, A realizable ecient parallel architecture, in Parallel Architectures and Their Ecient Use, First Heinz Nixdorf Symposium, LNCS 678, Springer, 1992, 93{109. [12] Y.M. Kim and T.-H. Lai, The complexity of congestion-1 embedding in a hypercube, J. Algorithms 12, No. 2, (1991) 246{280. [13] Y. Cai, S.-H. S. Huang, and C.-C. Lin, Embedding two-dimensional grids into hypercubes with dilation 2 and congestion 5, in Proc. Inter. Conf. on Parallel Processing, Oconomowoc, WI, III, 1995, 105{112. [14] D.S. Scott and J. Brandenburg, Minimal mesh embeddings in binary hypercubes, IEEE Trans. on Computers 37, No. 10, (1988) 1284{1285. [15] B. Alspach, J.-C. Bermond, and D. Sotteau, Decomposition into cycles. I: Hamilton decompositions, in Cycles and rays: basic structures in nite and in nite graphs, Proc. NATO Adv. Res. Workshop, Montreal, Can., 1990, 9{18.