392
3.1
Section 3.1 T h e H y p e r c u b e
T h e Hypercube
I n this section, we define the hypercube and e x p l a i n w h y i t is such a powerful n e t w o r k for parallel c o m p u t a t i o n . A m o n g other things, we w i l l show
how the hypercube can be used t o simulate a l l of the networks discussed
i n Chapters 1 a n d 2. I n fact, we w i l l find t h a t the hypercube contains (or
nearly contains) a l l of these networks as subgraphs. T h i s m a t e r i a l is b o t h
surprising a n d i m p o r t a n t because i t demonstrates how a l l of t h e parallel
a l g o r i t h m s discussed thus far can be d i r e c t l y i m p l e m e n t e d on t h e hypercube w i t h o u t significantly affecting t h e number of processors or the r u n n i n g
t i m e . Hence, we w i l l quickly u n d e r s t a n d one of the m a i n reasons w h y the
hypercube is so powerful.
We begin the section w i t h some definitions and a brief discussion of the
hypercube's simplest properties i n Subsection 3.1.1. I n Subsection 3.1.2,
we show t h a t the hypercube is H a m i l t o n i a n , a n d we e x p l a i n the correspondence between H a m i l t o n i a n cycles i n the hypercube a n d G r a y codes. We
also prove t h a t any A^-node array (of any d i m e n s i o n a l i t y ) is a subgraph of
the A^-node hypercube (assuming t h a t A" is a power of 2).
I n Subsection 3.1.3, we describe several embeddings of an (A" —
complete b i n a r y tree i n an A^-node hypercube. A l t h o u g h the (N —
complete b i n a r y tree is not a subgraph of the Af-node hypercube,
find t h a t a complete b i n a r y tree can be s i m u l a t e d very efficiently
hypercube.
l)-node
l)-node
we w i l l
on the
M o r e generally, we w i l l show t h a t the Af-node hypercube can efficiently
simulate any b i n a r y tree i n Subsection 3.1.4. I n p a r t i c u l a r , we w i l l show
how t o grow an a r b i t r a r y M - n o d e b i n a r y tree i n an on-line fashion i n an
A'-node hypercube so t h a t neighboring nodes i n t h e tree are nearby i n
the hypercube and so t h a t at most 0(M/N
+ 1) tree nodes are m a p p e d
to each hypercube node w i t h high p r o b a b i l i t y . T h e analysis of the treegrowing a l g o r i t h m involves an interesting relationship between one-errorcorrecting codes a n d hypercubes t h a t has numerous applications. We also
define the hypercube of cliques i n Subsection 3.1.4 a n d prove t h a t i t is
c o m p u t a t i o n a l l y equivalent t o the hypercube.
I n Subsection 3.1.5, we show how t o efficiently simulate a mesh of trees
on the hypercube. As a consequence, we w i l l find t h a t a l l of the a l g o r i t h m s
described i n Chapter 2 can be i m p l e m e n t e d w i t h o u t significant slowdown
on a hypercube of a p p r o x i m a t e l y the same size.
We conclude i n Subsection 3.1.6 w i t h a brief survey of some related
3.1.1
Definitions
and
Properties
000
0
00
\
010
10
o
Q
o
o
101
11
01
N =2
393
N =4
111
N = 8
F i g u r e 3-1
The N-node hypercube for N = 2, 4, and 8. Two nodes are linked
with an edge if and only if their strings differ in precisely one bit position. Dimension 1 edges are shown in boldface.
network containment and s i m u l a t i o n results for the hypercube.
3.1.1
Definitions a n d Properties
T h e r-dimensional
hypercube has N = 2 nodes and r 2 ~ edges. Each
node corresponds t o an r - b i t b i n a r y s t r i n g , a n d t w o nodes are l i n k e d w i t h
an edge i f a n d only i f their b i n a r y strings differ i n precisely one b i t . As a
consequence, each node is incident t o r = log N other nodes, one for each
b i t p o s i t i o n . For example, we have d r a w n the hypercubes w i t h 2, 4, and 8
nodes i n F i g u r e 3 - 1 .
r
r
1
T h e edges of the hypercube can be n a t u r a l l y p a r t i t i o n e d according
to the dimensions t h a t they traverse. I n p a r t i c u l a r , an edge is called a
dimension k edge i f i t links t w o nodes t h a t differ i n the kth b i t p o s i t i o n . We
w i l l use t h e n o t a t i o n u t o denote the neighbor of node u across dimension
k i n the hypercube. I n p a r t i c u l a r , given any b i n a r y s t r i n g u = i t i • • • u
,
the s t r i n g u is the same as u except t h a t t h e kth b i t is complemented.
M o r e generally, we w i l l use the n o t a t i o n ul »>*»>-.*.} t denote t h e s t r i n g
formed by complementing the kxth, k th, ..., and A; th bits of u. For
example, 0011010 = 0111010 a n d 0011010 ' > = 0000010 i n a 128-node
hypercube.
T h e dimension k edges i n a hypercube f o r m a perfect m a t c h i n g for each
k, 1 < k < log N. (Recall t h a t a perfect m a t c h i n g for an Af-node g r a p h
is a set of A^/2 edges t h a t do not share any nodes.) Moreover, removal of
the dimension k edges for any k < log A^ leaves t w o disjoint copies of an
k
i o s N
k
fc
Q
2
2
s
{3
4
394
Section 3.1 T h e Hypercube
y - n o d e hypercube. Conversely, a n TV-node hypercube can be constructed
f r o m t w o y - n o d e hypercubes b y s i m p l y connecting the ith node of one y node hypercube t o the ith node of the other for 0 < i < y . For example,
see F i g u r e 3-2.
I n a d d i t i o n t o a simple recursive s t r u c t u r e , t h e hypercube also has
many o f the other nice properties t h a t we w o u l d like a network t o have.
I n p a r t i c u l a r , i t has low diameter ( l o g i V ) and h i g h bisection w i d t h (N/2).
T h e b o u n d o n t h e diameter is easily proved b y observing t h a t any t w o
nodes u = u u
x
2
• • • u\
ogN
«i«a •'' "log
—»•••—»
a n d v = VyD? • • • V\
are connected b y t h e p a t h
ogN
N —*
VlV
2
Viu
2
• • • nlog
N
• • • U i g N-lU\o N
0
g
—> V i ^ U 3 • • • " l o g N
2
—> V V
X
2
•••
V\ .
ogN
T h e b o u n d o n bisection w i d t h is established by showing t h a t the smallest
bisection consists o f the edges i n a single dimension. T h e proof follows as
a special case of T h e o r e m 1.21 f r o m Section 1.9.
As a n interesting aside, i t is w o r t h n o t i n g t h a t a hypercube can be
bisected by removing far fewer t h a n y nodes, even t h o u g h y edges are
required t o bisect the A - n o d e hypercube. For example, consider t h e p a r t i t i o n formed by r e m o v i n g all nodes w i t h size
and p2t£"|. (
T
h
e
size,
or weight, o f a node i n the hypercube is the number of I s contained i n its
b i n a r y s t r i n g . ) A simple calculation reveals t h a t removal of these nodes
forms a bisection w i t h G (N/ \/log N) nodes, w h i c h is t h e best possible.
T h e details of these and some related results are left t o the exercises (see
Problems 3.3-3.7).
I t is also w o r t h n o t i n g t h a t the hypercube possesses m a n y symmetries.
For example, i t is node and edge symmetric.
I n other words, b y j u s t relabelling nodes, we can m a p any node onto any other node, and any edge onto
any other edge. M o r e precisely, for any pair of edges (u, v) and (u , v') i n an
A - n o d e hypercube H, there is an a u t o m o r p h i s m a of H such t h a t o~(u) = u'
and o(v) = v'. ( A n automorphism
o f a graph is a one-to-one m a p p i n g of
the nodes t o t h e nodes such t h a t edges are mapped t o edges.) I n fact,
there are m a n y such automorphisms. For example, let u = u u • • • U\ ,
u' = u[u' • • • u [ , k be t h e dimension o f (u, v), a n d k' be t h e d i m e n sion of (u , v'). T h e n for any p e r m u t a t i o n n o n { 1 , 2 , . . . , log A"} such t h a t
n(k') = k, we can define an a u t o m o r p h i s m a w i t h the desired p r o p e r t y by
setting
1
x
2
1
o gN
2
ogN
3.1.1
Definitions
and
Properties
395
F i g u r e 3-2
Construction of a four-dimensional
hypercube (b) from two threedimensional hypercubes (a). Dashed edges form a matching between the two threedimensional cubes.
Section 3.1 T h e H y p e r c u b e
396
F i g u r e 3-3
Two labellings of the 8-node hypercube. By relabelling appropriately,
we could have mapped edge e = (000,001) to any position in the network.
a(x X
x
2
• • - X
]
o
g
N
0 t l * ( i ) ®u[)
=
)
(aV(log/V) ©
| (x ( )
©«*(2) © « 2 ) I " * I
n 2
^(lcgAT) ©
U\ogN)-
(3-l)
(Here a n d t h r o u g h o u t Chapter 3, we use t h e n o t a t i o n a \ 8 t o denote
the concatenation of a and B.) I t is a simple exercise t o check t h a t a
is an a u t o m o r p h i s m of t h e hypercube w i t h the desired properties. (See
P r o b l e m 3.10.)
As an example, we have i l l u s t r a t e d t w o labellings of t h e 8-node hypercube i n F i g u r e 3-3. I n the example, we have m a p p e d the edge (000,001)
t o edge (110,100) using the a u t o m o r p h i s m
a(x x x )
1
2
3
= (xi © 1) I (x
3
© 1) I x .
2
I n general, we can rearrange the dimensions of the edges i n any order t h a t
we w a n t (by v a r y i n g n) w i t h o u t altering the n e t w o r k . (See Problems 3 . 1 1 3.13.) We w i l l use such symmetries r o u t i n e l y i n the chapter t o simplify
explanations.
3.1.2
C o n t a i n m e n t of A r r a y s
One of the most interesting properties of the A - n o d e hypercube is t h a t i t
contains every A^-node array as a subgraph. T h i s result holds t r u e even
for high-dimensional arrays and even i f w r a p a r o u n d edges are allowed. For
example, the embedding of a 4 x 4 array i n a 16-node hypercube is shown
© Copyright 2026 Paperzz