The Congestion of n-cube Layout on a Rectangular Grid S.L. Bezrukov J.D. Chavez L.H. Harper M. Röttger U.-P. Schroeder Abstract We consider the problem of embedding the n-dimensional cube into a rectangular grid with 2 n vertices in such a way as to minimize the congestion, the maximum number of edges along any point of the grid. After presenting a short solution for the cutwidth problem of the n-cube (in which the n-cube is embedded into a path), we show how to extend the results to give an exact solution for the congestion problem. 1 Introduction Let G = (V, E) represent a graph with vertex set V and edge set E. We may think of G as representing the wiring diagram of an electronic circuit, with the vertices representing components and the edges representing wires connecting them. A (vertex) numbering of G is a function η : V 1, 2,..., V }, which is one-to-one (and therefore onto). A numbering may be thought of as an embedding of G into a linear chassis. The cutwidth of G, with respect to η, cw(g; η), is the maximum number of wires which pass any point on the linear chassis: cw(g; η) = max (v, w) E η(v) l < η(w)}. l Then, the cutwidth of G is cw(g) = min cw(g; η). η The cutwidth problem is to find the value of cw(g). While the cutwidth problem is, in general, NP-complete [2], the solution is known for the n-cube and for some other families of graphs, such as the product of complete graphs (see e.g. [5]). In this paper, we extend that problem Department of Mathematics and Computer Science, University of Paderborn, Germany Department of Mathematics, California State University, San Bernardino, CA 92407 Department of Mathematics, University of California, Riverside, CA 92521 1
by taking the host graph to be a rectangular grid. We shall adopt the term congestion when considering grids as host graphs, and maintain the use of the term cutwidth when the host graph is a path. We denote by Q n the n-cube defined as the cartesian product of n edges. After presenting background material and a simple proof for the solution of the cutwidth problem for Q n in section 2, the main result of this paper is presented in section, where we give the solution of the congestion problem for the n-cube. 2 Background Given a graph, G, and a numbering, η, then for each l, 0 l V, define S l (η) = η 1 (1,..., l}). Thus, S l (η) is the set of the first l vertices of G to be numbered by η. For S V, define θ G (S) = (v, w) E v S, w S}, θ G (l) = min η θ G (S l (η)). For a fixed value of l, the problem of minimizing the value of θ G (S l (η)) over all numberings, η, can be thought of as a discrete isoperimetric problem. In fact, resulting isoperimetric theorems have proven quite useful. In [4] (see also []) it was shown that the solution of the isoperimetric problem for θ provides a lower bound for the wirelength problem for a graph. When G is the graph of an n-cube Q n, the lower bound is sharp, with the numbering, lex, corresponding to the lexicographic ordering of the vertices, providing θ Qn (l) = θ Qn (S l (lex)) for each l. 2.1 The cutwidth of the n-cube Given a graph, G, let η : V 1, 2,..., m}, where m = V, be a numbering of the vertices of G. Then, cw(g; η) can be thought of as the maximum number of wires which pass any point on the linear chassis. Let the point be between l and l + 1. Since every wire which has one end numbered less than or equal to l, and the other greater than or equal to l + 1 must pass this point, cw(g; η) = max 0 l m θ G(S l (η)). And so the cutwidth of G is defined by cw(g) = max 0 l m θ G(l). (1) Theorem 1 cw(q n ) = 2 n+1 2 if n is even 2 n+1 1 if n is odd. 2
Proof. Since we know that for Q n, the numbering given by the lexicographic ordering of the vertices minimizes θ Qn (S l ) for each l (see [4]), (1) implies cw(q n ) = max 0 l 2 n θ Q n (S l (lex)). The keys to computing cw(q n ) and related parameters are the following observations about θ. For a graph G and S V, θ G (S) = θ G (S c ), where S c = V \ S. Thus, θ G (l) = θ G ( V l). (2) That is, θ Qn (l) is symmetric about 2 n 1. Its maximum does not generally occur at 2 n 1, however, we need only look at l 2 n 1 in searching for the maximum. Furthermore, on Q n we have the following recursion. θ Qn (S l (lex)) = 2l + θqn 2(S l (lex)) if 0 l 2 n 2 2 n 1 + θ Qn 2 (S l 2 n 2(lex)) if 2 n 2 l 2 n 1. () For the recursion given in (), observe that its maximum value is achieved at some l from 2 n 2 to 2 n 1. To see that this is true, for each l, 0 l 2 n 2, let l = l + 2 n 2. Then we see that θ Qn (S l (lex)) = 2 n 1 + θ Qn 2 (S l 2 n 2(lex)) = 2 n 1 + θ Qn 2 (S l (lex)) 2l + θ Qn 2 (S l (lex)) = θ Qn (S l (lex)). From (2) and () we obtain the recurrence relation, 0 if n = 0 cw(q n ) = 1 if n = 1 2 n 1 + cw(q n 2 ) if n 2. Solving this recurrence we have the Theorem. Thus, cw(q n ) 4 2n 1 as n. 2.2 Example The wiring diagram that results from embedding Q 4 into a linear chassis (using the lexicographic numbering) is shown in Figure 1. Note that the cutwidth of Q 4 is 10, with that value being achieved at several points (but not at l = 2 ). In general, the maximum value of θ Qn (l) does not occur at l = 2 n 1. Where, then, does it occur? Let l M (n) = minl θ Qn (l) = max 0 l 2 n θ Q n (l)}.
0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 Figure 1: Q 4 embedded in a linear chassis Then l M (n) = 0 if n = 0 1 if n = 1, and l M (n) 2 n 1 by (2). In fact, l M (n) = 2 n 2 + l M (n 2) by (). Therefore, Thus, l M (n) 2n as n. l M (n) = 2 n 1 if n is even 2 n +1 if n is odd. From this one sees that the set of l s where θ Qn (l) takes its maximum value, cw(q n ) 4 2n 1, approximates a Cantor set. Furthermore, if we let then #(n) = l θ Qn (l) = cw(q n )}, 0 if n = 0 #(n) = 1 if n = 1 if n = 2. The recursion () implies that for n > 2 the maximum of θ Qn (l) is achieved at some l, 2 n 2 < l < 2 n 1. Since θ Qn (l) is symmetric about 2 n 1, one has #(n) = 2 #(n 2). Therefore, #(n) = = n 2 2 2 if n > 0 and even 2 n 1 2 if n odd 2 2 n if n > 0 and even 1 2 2 n if n odd. The congestion of the n-cube In this section we consider the problem of minimizing the congestion of the n-cube. The congestion problem is of particular interest in rectilinear network layout design (see [1] for a nice summary). As with the cutwidth, the congestion, con(g : H), is the minimum over all η : V G V H of the maximum number of wires that pass any point on the (host) graph. Note that in addition to 4
arranging the vertices on the host graph (n! possibilities as in the linear case), the wires must be laid out on the rectangular grid in such a way as to minimize the number of wires along any point. Our strategy is to obtain a lower bound for con(g : H), based on the known solutions of isoperimetric problems, and then show that the lower bound is achieved. Let G and H be graphs and let η : V G V H be a one-to-one function. We assume that H is connected, so that θ H (l) 0 if 0 < l < n. Lemma 1 θ G (l) con(g : H) max 1 l<n θ H (l). Proof. Suppose that T is any subset of V H. Then θ H (T ) con(g : H) θ G (η 1 (T )), since each of the edges from η 1 (T ) to η 1 (T c ) must be assigned to a path from T to T c, which contains at least one edge counted by θ H (T ). Each such edge e V H can have at most con(g : H) edges of E G assigned to it, so the inequality must hold. For the left hand side of this inequality, the worst case is that T minimizes θ H for its cardinality, so θ H (l) con(g : H) = θ H (T ) con(g : H) θ G (η 1 (T )) θ G (l). We apply this result to calculate con(q n : F ), where F = P 2 n 1 P 2 n d, with d 2, n 1 + + n d = n and n 1 n d. Theorem 2 con(q n : F ) = cw(q nd ). Proof. Denote n = n 1 + + n d 1 and let l = 2 n 1 2 n 2 + 2 n + ( 1) n n +1 2 n. Note that 2 n 2 l < 2 n 1 and l = a 2 n for some integer a. Consider the 2 n 1 2 n d 1 a subgrid T of F. One has θ F (l) θ F (T ) = 2 n. Also, by an argument similar to that for identity (), θ Qn (l) = 2 n 1 + 2 n + + 2 n if n d is odd 2 n 1 + 2 n + + 2 n +1 if n d is even. 5
Therefore, θ Qn (l) θ F (l) 1 2 n 1 + 2 n +... + 2 n if n d is odd 2 n 2 n 1 + 2 n +... + 2 n +1 if n d is even 1 + 2 = 2 + 2 4 +... + 2 n d 1 if n d is odd 2 + 2 +... + 2 n d 1 if n d is even 2 n d +1 1 if n = d is odd 2 n d +1 2 if n d is even = cw(q nd ). Then, by Lemma 1, con(q n : F ) cw(q nd ). On the other hand, let η : Q n F equal the product of the numberings lex i : Q ni P 2 n i, i = 1,..., d, that solve their corresponding cutwidth problems. Running all wires along one dimension of F, we have con(q n : F ) max i cw(q ni ) and so the theorem. 4 Conclusion An important characteristic of the n-cube is that it is factorable (in many ways) as a product of lower dimensional cubes. One may wonder if the above results apply to all graphs that may be factored as products of subgraphs. The following example shows that that is not the case. Consider the product of the complete graphs K 4 and K 2, shown in Figure 2. This graph may be embedded into a 2 4 grid as shown in Figure. But con(k 4 K 2 : P 2 P 4 ) = < 4 = cw(k 4 ). 4 1 2 b a Figure 2: K 4 K 2 Our results might be extended for solving the cutwidth or congestion problem for other families of graphs (with the host graph a path or a grid). Another possible direction for extension would be to solve the congestion problem for the n-cube with a different host graph, such as a cycle. References [1] F.R.K. Chung. Labelings of Graphs, Graph Theory, Academic Press, 1988. 6
a 4a 4b b 1a 2a 2b 1b Figure : K 4 K 2 embedded in P 2 P 4 [2] M.R. Garey and D.S. Johnson. Computers and Intractability, A Guide to the Theory of NP-Completeness, Freeman, San Francisco, 1979. [] L.H. Harper and J.D. Chavez. Global Methods of Combinatorial Optimization, to appear in The Encyclopedia of Mathematics, Cambridge University Press. [4] L.H. Harper. Optimal assignments of numbers to vertices, J. Society Industrial and Applied Mathematics 12 (1964), 11 15. [5] K. Nakano. Linear Layouts of Generalized Hypercubes, Lecture Notes in Computer Science 790, Springer-Verlag, 1994. 7