on the loop sw itching address ing...
TRANSCRIPT
ON THE LOOP SW ITCHING ADDRESS ING PROBLEM
bY
Andrew C. Yao
--
STAN-CS-77-626OCTOBER 1977
COMPUTER SC IENCE DEPARTMENTSchool of Humanities and Sciences
STANFORD UN IVERS ITY
On the Loop Switching Addressing Problem
Andrew Chi-Chih Yao
Computer Science DepartmentStanford University
Stanford, California 94305
Abstract.
The following graph addressing problem was studied by Graham and
Pollak in devising a routing scheme for Pierce's Loop Switching Network.
Let G be a graph with n vertices. It is desired to assign to each
vertex v. an address in1 -- p,1, *I1 J such that the Hamming distance
between the addresses of any two vertices agrees with their distance
in G. Let N(G) be the minimum length 1 for which an assignment
is possible. It was shown by Graham and Pollak that N(G) 5 mG(n-1) ,
where mG
is the diameter of G . In the present paper, we shall prove
that N(G) < l.O9(lg mG)n+ 8n by an explicit construction. This shows
in particular that any graph has an addressing scheme of length
O(n log n) .
- Keywords: addressing scheme, binary tree, graph, Hming distance,
loop switching network.
This research was supported in part by National Science Foundation grantMCS 72-03752 A03.
1
1. Introduction.
AIrI interesting routing scheme to Pierce's Loop Switching N&work
[71 was proposed by Grahm and Pollak [3,4] (see also [l]). DI this
scheme, Pierce’s network is represented by"a graph where vertices stand
for the loops, and edges stand for the contacts between loops in the
network. The scheme calls for assigning a sequence of ternary symbols
to each vertex such that the distances between vertices in the graph
are faithfully represented. The combinatorial problem is described
below; for a detailed discussion of the connection between Pierce's
network and this conibinatorial problem, as well as further information
on the subject, see references [1,3,4,7].
Throughout our discussion, G =
a set V of vertices, and a set E
length t in G frm a vertex vi
vertices . . ..vvko'vkly kt such that
cvks cvks ]EE for s = 1,2, ..a) t .
(V,E) will be a connected graph with
of undirected edges.
to a vertex v. is a3
vkOEV
i ’ vkt = vj
A path of
sequence of
t and
The distance dG(vi,vj) between
vertices Vi and vj is the minimum length t for which a path of
Length t frcnn vi to vj exists. The diameter of G ) denoted by mG I
is the largest distance between any two vertices in G . That is,
-Let C be the ternary symbol set {O,l,*j . (The character Ii *'I
is a "don't-care" symbol.) The Hamming distance H between elements in c
is defined by H&O) = H(O,l) = 1 1 and H(a,b) = 0 for all other pairs
of a,b in c . For two sequences a! = ala2.., aI and f3 = blb2,.,b1
in c' , where 1>0, their Hamming distance is given by
H&M) = x H(ai,b.) .l<i<1 1- -
2
An addressing scheme for a graph G = (V,E) with n vertices is
an assignment of a sequence c(vi) ' cl to each vertex vi such that
H(C(Vi),C(Vj)) = dG(vi,vj) for all vi, v. in V .J
The positive
integer 1 is called the length of the addressing scheme, and the
sequence c(vi) the address of vertex vi , It is desired to find
addressing schemes with small length. Let N(G) be the minimum 1 for
which sn addressing scheme of length I exists for G . In [3], it was
proved that an addressing scheme always exists (i.e., N(G) < 03 ), and
furthermore, N(G) 5 mG(n-1) . We shall improve this bound by explicitly
constructing an addressing scheme. The main results are as follows:
(We shall use =i to denote the constant $ lg 3 + f lg $->-' = 1.09 .)
Theorem 1, For a graph G with n vertices,
N(G) 5 A n lg n + 2n .
Theorem 2. For a graph G with n vertices,
N(G) 5 A n(lg mG) + 8n .
e Note : lg means logarithm to the base 2.
2. Definitions and Preliminaries.
Let G = (V,E) be a (connected, undirected) graph. A path
Vk ☺Vk Y l l .,Vkin G is simple if all the vertices vk for 9 < s < t- -- -
9 1 t S
are distinct, except possibly for vk A graph G' = (V',E')0
= vk. .til
is called a subgraph of G if V' c V and E' c, E . A subgraph
G' = (V',E') is said to be a tree in G if G' is connected and there---
is no simple path of length > 0 in G' from any vertex VEV' to itselS.
A tr?c I~’ = (V’, E’ ) in G is a spanning tree for G if V' = V . For
aajr subset of vertices V'CV, the diameter of V' , written diam,(V') ,u
is max{dG(vi,vj) 1 viyvj EV'~ . In particular, diamG(V) = mG . The
distance dG(Yi, V' ) between a vertex vieV and a subset V' c V is---- -
defined as dG(vi,V') = min(dG('vi,vj) 1 Vj~V') l
WZ s:lall make use of binary trees in our design process. (See for
example Knuth [5] for .basic definitions regarding binary trees.) Let T
be a binary tree with n leaves. Ass'&me the nodes of T are numbered
arbitrarily from 1 to 2n-1 . The node with n'lmber k will be denoted
by $ lWe will also use the
and 0J for an internal node
b< the subset of leaves in T
of R(k) is called the weight
notation icl for a leaf numbered i ,
numbered j . For a node rk , let R(k)
which are descendants of rk . The size
of rk' denoted by w(k) . For ex=Aple,
W'S have R(1) = (r8,'Qrg) , R(2) = (r2) , and W(1) = 3 , w(2) = 1 in
Figure 1. The external path length P(T) is defined by the following equation
P(T) = c w(k) l (1)
internal node rk
The quantity P(T) can alternatively be described as the sum of the
distances from the leaves to the root [5]. If ri and rj are respectively
the leftson aad the rightson of rk , we shall write i = leftson ,
Figure1
j= rightson ; k = father(i) = father(j) ; and j = brother(i
i = brother(j) . As a shorthand, we shall use E for father(k)
> Y
and
k' for brother(k) . A binary tree T is said to be weight-balanced
if for each internal node rk'
$ w(k) 5 w(lef'tson(k)) < $ w(k) ,
$ w(k) 5 w(rightson(k)) 5 F w(k) .
(2)
The following result is from [6, Theorem 21.
Lemma 1 [Nievergelt and Won@;]. If T is a weight-balanced binary tree
with n leaves, then the external path length of T satisfies
P(T) 5 h n lg n m 1.09 n lg n .
In a binary tree T , if a leaf c li precedes another leaf jc l
in post-order [5], we shall say that IIIi is to the left of j (ora
a is to the right of q ), and write !il + q (or equivalently
LjlqTJ ). We further extend the relation so that
u'i brk i f a<.a for a3l descendants jI3
of rk'
wi 3 - rk if a+-ljl for all descendants jcl of rk'
Clearly, for any leaf and node rk 4 rk , ic l -> rk ,
or iq is a descendant of rk ; and exactly one of the three relations
holds. In Figure 1, we have ~.~,~~@,and@>@.
3a TheConstruction of a Length O(n I& n) Addressing Scheme.
3.1 The Design Tree.
The key to obtaining an O(n lg n) scheme is by using a hierarchical
design. A design tree M is a pair (T,f) where T is a binary tree
with n leaves, and f is a one-to-one mapping from the leaves of T
to the vertices of G , For notational convenience, we shall nurriber the
nodes of T in such a way that the leaves receive numbers 1 to n and
leaf ia is associated with vertex vi under f . The root of T will
be labeled with 2n-1 ; and the remaining internal nodes tith n+l through
2n-2 (their actual numbering will be unimportant for M ).
We now describe an addressing scheme Z(M) corresponding to a
given design tree M . Every address c(vj) in Z(M) wiJl consist of*
2n-2 blocks of code, where the k-th block has length pk (to be defined
later) and is conceptually associated with the node rk of T . (N to e
that rk cannot be the root since k f 2n-1 .) Thus we shall write,
for lzisn,
where cik = ik lI I (3 >
By definition, the Hasrming distance between two addresses c(vi) and
‘Cvj)is equal to the sum of the Haznming d&stances between corresponding
. blocks. That is,2n-2
H(c(vi),c(vj)) = C H(cik,cJk) 'k=l
(4)
We shall design the code in such a way that in (4), only a few terms will
contribute to the sum, other terms being zero. For example, consider the
design tree M showninFigure2. We shaU in fact have
7
Figure 2. A design tree 1.1 with a marked path.
--_
and H(c3 k,~2 k) = 0 for k+ {10,11,2] . The trick to achieveY ?
H(43),4v2) \ = dG(v3,v2) is as follows. Define S(k) = {f(ri> 1 ri ~3(j:\i
i.e., SW is the set of vertices associated with the leaf descendants
of rk . We shall require that,
H(ce 3112 ) c*,lo!
= $p3’s(~W Y
H(cj l,J,‘C, lo) + NC3 -J-y c2 11) = qy0~)) Y
Y L.Y Y Y
+Q,c2,10 ) + H(~~,~~,5-4 -+ H(c3,2~C2,2) = dG(V3,s(2)) l (6�!
We can view (6) in the following way. Starting at the lowest common
ancestor (lea) of a and B (i.e., the common ancestor of 3 andc l
q2 farthest from the root), which is' rl? , we move down the pathi
50 ’ k. ’ to the leaf r2 . Each node rk encountered along the path,
8
excluding the lea, will add a block of code which creates enough Hamming
distance to bring the total up to d(v3,S(k)) . An equivalent form of
NC3,kyc2,k) = dG(V7’S(k) ) - dG(V3’S(Q >
for k =: 10,11,2 , and c t: father(k) .
In general, we want to achieve the following. For a e m , let
node h, be the lowest common ancestor of i and j , andcl cl
node h0 to c lj , then
"
ho+, . . 'Y ht= j be the path fram
H(c.i,kJCj,k =) d(viY 'Ck ) - d(viY ‘(‘) )
for k = hl,h2, . . 0, ht , and i = father(k) ;
NCi-&Y’j,k) = Ofor all other k . (8)
It is easy to verify that (8), if true for all BGa,wiUbe
sufficient to guarantee that Z(M) = {c(vi) 11 5 i 5 n) , as given by (3),
is an addressing scheme, That is, dG(ViY v j > = H(c(vi),c(vj)) for all
i,j. We now describe a construction of the cik's that satisfy (8).
Z(M): The Addressing Scheme Induced by M . For each k, 1 < k < 2n-2 ,- -
let
lk = ma⌧
l<i<n☯dG(vi,S(k)) - dG(Vi,S(�) > I l
- -
. The block Cik J for 15 i 5 n , has length Ik and is given by
Cik =*** c - - . . , *
(9)
if ic l is a descendant of rk ,
if ai *rk,
with 6 5 dG(Vi,S(k)) - dG(Vi,S(')) Y
if c li4rk'(10)
Finally, form Z(M) = {c(vi) 11 < i < n] according to (3). The length- -
of Z(M) Y denoted by T(M) , is
-c(M) = cl<k<2n-2
'k '- - -.
To see that Z(M) is actually an addressing scheme, we need only
show that (8) is satisfied, For q + a , we see from (10) that
H(cik,Cjk) = 0 unless ni -uk and ljl is a descendant of rk;
in the latter case, 0ik'cjk) E: dG(vi,S(k)) - dG(Vi,S(k)J l But this
is exactly as required by (8), q.e,d.
(11)
3.2 Criteria for-a Good Design Tree.
Let us find out what sort of design tree M will generate a short
addressing scheme, Notice that for any 15 i < n , 1 < k < 2n-2 , we- -
have
dG(vi,S(k)) -d(-~(Vi9S(it)☺ < di~,(s(3! l02)
-
Inequality (12) is valid, since we can concatenate a path from vi to the
nearest point in s(k) , with a path of length at most diamC(S(k)) , to
reach a vertex in SW lThis tells us that
-
Pk s diamC(S(K)) . (13)
An upper bound to T(M) is therefore
7 04 < c- diamC(S(k)) = 2 c dim(;l<k<2n-2 n+l<k<2n-1- -
(S(k)) , (14)- -
every internal node being the father of two nodes. This upper bound will
in general be O(n2 Y as the subset S(k) may have diameter O(n) for
many k. However, if we insist on two conditions
10
( >i no two points in S(k) are far apart compared to its size p<k>l Y
specifically, dam > 5 1 SW 1 ; and
(ii) the binary tree is weight-balanced,
then (14) would give. .
T(M) < 2 lx- )S(k) 1 = 2.P(T) 5 2hn lg nn+l<k<2n-1- -
by Lemma 1.
(15 >
To achieve conditions (i) and (ii), we use the following idea. Let
us think of M = (T,f) as a tree built topdown by successively breaking
V into smaller parts. From this viewpoint, the tree in Figure 2 is
obtained by first dividing (at node 15 )
b5,v@v13 and {~~YV~YV~~~~Y~~] ; each
further divided into Iv5 3 , &j,vll at
at node 12, respectively. This process
the singleton sets {vi) .
of the two resulting parts are
node 9 Y and (V4, V33 I {V,Y”~Y~~)
is repeated until we have only
We shall see that in building M in this fashion, it is possible to
keep the points in
the two parts moree
decomposition, We
each part close together (condition (i)), and also make
or less equal in size (condition (ii)) on each
shall describe such a method next, and then perform a
finer analysis improving the bound given by (15).
3.3 Constructing M fram a Spanning Tree.
We shall construct a design tree M with the properties (i) and
(ii) given in Section 3.2. Choose any spanning tree with edge set A
for the graph G , Let us create a new vertex v. and a new edge (vo,vl) .
We now define a one-to-one mapping cp between the edge set of the
augmented spanning tree A' = AU ({vo,vl')] and the vertex set V
(without v. ). The mapping cp is obtained by regarding (vu Cv,]YA')
as a rooted tree with root v0 ,and mapping each edge onto its "lower"
end point. We shall then number the edges ei in A' so that
(p(y) = vj, lAn example of this process is shown in Figure 3.
() G4
. v3
( >a
v3
04
Figure 3. (a) A spanning tree on V = (v1’Yp V3Y V4’“s ] , and
(b) the labelling of its edges after augmentation.
Our plan is to construct a binary tree Q by "suitably" splitting
the edge set A' into two disjoint subsets, and repeat the process until
only one edge remains in each subset. Figure 4(a) shows the binary
tree Q that may result from this process when applied to the spanning
tree in Figure 3(b). Although the tree Q so constructed is not a design
tree on the vertex set, we can easily obtain such a design tree MQfrom
12
Y
Q in a natural way via the mapping cp , We shall transform Q into
MQsimply by identifying ei with v.1
in the tree Q . The design
tree M, obtained from the Q in Figure &(a) is shown in Figure 4(b).
We can now complete our task
topdown construction of a Q for
conditions (i) and (ii), and (2)
by such anMQ l
in two steps, (1) describe the
which MQ
would satisfy
analyze the addressing scheme induced
(1) Constructing Q . A set of edges B in G is called a
-Lree set if B is the edge set of some tree in G . Two tree sets Bl
and B2 is said to--form a decomposition of the tree set B if BlnB2=$
and B+B, = B . Note that, in such a decomposition, there is a uniqueL
vertex vs that is incident to both Bl and B2 , For example, in
&ure 3(b), B = (e2,e4,e5] is a tree set. We can decompose B into
c 3e2 and Ce4ye53 with v1 being the unique vertex vs .
A decomposition of B into Bl and B2 is balanced if
$ _ 12BI IB <Bi. 3 11for i=1,2 . The following lemma is implicit
in [2].
a
Lermna 2 [Chung and Graham]. Any tree set B with 1~1 2 2 has a
balanced decomposition into two tree sets.
Let us now construct Q by breaking the augmented spanning tree A'
into parts successively, using a balanced decomposition at each step. For
example, the tree Q shown in Figure 4(a) can be obtained this way from
A' in Figure 3(b). Once Q is constructed, we transform it into a
design treeMQ
for the vertex set as described previously. It remains
14
to analyze the address length obtained frcrlJl this tree MQ.
To avoid
confusion, we use S(k) for the set of vertices associated with node
rk in MQ'and use B(k) to denote the tree set at the corresponding
node in Q . Clearly, if S(k) = {vi ,vi ,...,vi ) , then1 2 t
B(k) = {e. ,e.5 l2
Y l o*, e. .
%3
(2) Analysis. There are two simple properties of the design
tree MQ*
Firstly,MQ
is weight-balanced by construction, Secondly,
at any node rk of MQ'
diamG(S(k)) 5 IS(k)1 . This is true since
any two vertices in S(k) can be connected through at most pw 1
edges in the tree set B(k) ' Thus, the two conditions (i) and (ii) in
Section 3.2 are satisfied, which implies T(M) 5 2)n lg n . A stronger
bound can be obtained, however, by using the following lemma.
Lemma 3. For each node rk in MQ, and 1 < i < n ,- -
dG(vi, S(k)) - dG(Vi' S(c)) < l+ IS( , where kt = brother(k) . (16)
Proof. Let v.3
be a vertex in S(k) closest to vi , i.e.,
dG(Vi,Vj) = dG(vi,S(i;)) . (17)
If vj&(k) , then dG(vi,S(k)) = dG(vi,S(k)) , and (16) is true. So
_ we can assume that vj E S(k') .
Let vs be the unique vertex that is incident to both an edge in
B(k') and an edge in B(k) . This implies that
dG(Vj�Vs) < l~(k~)I = Is( l (18)
Now, let (v,,v+.) be an edge in B(k) incident with vs (see Figure 5).
15
3
Then,
dG(Vi, vs
” --I ‘L ’ I 3 e
Figure fi
> '= 'G(Vi,Vj) '-'iG("j,",) i dG(Vi,S(lr
viY vf ) ’ d,~(viYv,~) + ’., - ,-> : d,m(vi,S(k))+l+ (S(k')\ . ( 20)'LX
c 7rs7~ft) cB(k) , either v or vt must be in S(k) . Therefore,S
d,(V.i, S ( k ) ) � ma⌧Cd,(.viyV~)yd,.,(vi,vt)) lJ - \I I3 'J (21)
(15) follows from (lg), (20), and (21). U
Lemma 3 implies that,
'k = max (dG(.iri,S(k)) - d7(viyS(k))] < l+ )S(k') I .i
16
Q!lQ) = lL lk< cl<k<2n-2 - l<k<2n-2
(1 + ISW 1)- - a -
= 2n-2+ c pcq l (�2)
l<k<2n-2c -
Making use of the fact that MQ is weight-balanced and Lemma 1, we
obtain after simplification,
m LK Anlog n + 2n .
This proves Theorem 1,
3.4 Proof of Theorem 2.
When mG, the diameter of G , is substantially smaller than n-l ,-=
the addressing scheme we have constructed is better than the bound in
Theorem 1 indicates. The key observation is that lk is always no greater
than mG , because lk 5 InaX dG(vi,S(k)) 5 mG . In the analysis ofi
T(MQ, = xa, , we can thus use mG tobound lk, instead of l+ IS(k)\ ,
for some of the nodes rk .
Let X be the set of nodes rk in MQ
such that ls(k)l 5 mG 9
and IS(k)/ > mG . For each rkeX , let Jk = (rj I rj is a descendant
- of rkj rj d rk) . Let J = ~j Jk . In Figure 6, assume m 4 ,
rk E X G=
the set X then consists of the nodes marked by arrows, and J is the
I set of shaded nodes. We shall use inequality lk < l+ IS( for the
nodes rkEJ 9 and use lk 2 mG for the remaining nodes in deriving a
bound for -r(MQ) .
The following facts will be used in the calculation.
Fact 1. Let q be the number of nodes not in J , then q < * ,mG
17
Figure 6. The set of shaded nodes is J .
18
Proof. J =I I c (2+(k)l -2) = 2 -21X[ = 2n-21X( .rk E x
Hence q = 2n-l- 1~1 = 21x1 -1 . Since \S(k)l 2 $ IS(~)) 2 $mG for rkEX , *
we have X <I I n-1' Thus,
F mG
Fact 2. Let rkeX , then c IfW)l 5 hlS(k)llg1S(k)l .rj E Jk
Proof. c \S(j')( = 2 IS(j)\ . Fact 2 then follows from the
2 ' Jk 7 ' Jkfact that the subtree of M
Qrooted at r
kis weight-balanced. IJ
We can now prove the desired bound as follows:
‘c”Q) = y $+‘kbJ
r lk” rrkE J - rkiJ
mG+ c (l+ IS&‘) 1:)rkEJ .
= qmG+ IJ\+ r C )W)rkEx rjEJk
l mG+2n+hrk c x
where we have used Facts 1 and 2 in the last step.
Equation (24) leads to, by using IS(k)) < mG ,
T(M~) 5 an+ h(lg mG) c IS(k) \rk E x
= 8n+ A(lg mG)'l '
(24)
This completes the proof of Theorem 2. IJ
19
4. Remarks.
In this paper we have given an algorithm which, for a graph with n
vertices, constructs an addressing scheme of length O(n log n) . The
algorithm can be implemented straightforwardly, and has a O(J) running
time on a random access machine.
Some slight improvements on our bounds can be obtained by minor
modifications of the construction. For example, the 8n term in
Theorem 2 can be lowered to 4n , However, we have not found a construction
that is guaranteed to give an address of length less than O(n log n) .
The very attractive conjecture N(G) 5 n-l of Graham and Pollak [3,4] thus
still remains an open problem.
Acknowledgements. I wish to thank Ronald L. Graham for introducing this
problem to me in a stimulating conversation on this subject.
20
References
[l] L. H. Brandenburg, B. Gopinath, and R. P. Kurshan, "On the addressing
problem of loop switching," Bell System Technical Journal 51 (1972),
1445-1469. a.[2] F. R. K. Chung and R. L. Graham, "On graphs which contain all small
trees," to appear in Journal of Combinatorial Theory (B).
[3] R. L. Graham and H. 0. Pollak, "On the addressing problem for loop
switching," Bell System Technical Journal 50 (1971), 2495-2519.
C41 9 "On embedding graphs in squashed cubes," in Graph Theory
and Applications, Lecture notes in Mathematics, number 303, Springer-
Verlag (Proc. of a conference held at Western Michigan University,
May l-0-13, 1972).
[51 D. E. Knuth, The Art of Computer Programming2 Vol. 1, Fundamental
Algorithms; Second Edition, Addison-Wesley, Reading, Mass., 1975.
[ 61 J. Nievergelt and C. K. Wong, "Upper bounds for the total path length
of binary trees," Journal ACM 20 (1973), 1-6.
[7] J. R. Pierce, "Network for block switching of data," Bell System
Technical Journal 51 (1972), ll33-1145.
21