Information Processing Letters 112 (2012) 129–134
Contents lists available at SciVerse ScienceDirect
Information Processing Letters www.elsevier.com/locate/ipl
Optimal broadcasting for locally twisted cubes Xiaofan Yang a,b , Lei Wang a,∗ , Luxing Yang a,b a b
College of Computer Science, Chongqing University, Chongqing 400044, PR China College of Mathematics and Statistics, Chongqing University, Chongqing 400044, PR China
a r t i c l e
i n f o
a b s t r a c t
Article history: Received 10 April 2011 Received in revised form 11 June 2011 Accepted 3 November 2011 Available online 9 November 2011 Communicated by J. Xu
This paper addresses the single node broadcast problem over a locally twisted cube (LTQ). The broadcast algorithm proposed for this problem uses a new broadcast tree construction which can run in time O ( N log N ) where N = 2n is the number of the nodes in LTQ. The broadcast tree turns out to be optimal in terms of the number of transmission steps. To the best of our knowledge, it is the first time to present an optimal broadcast algorithm for LTQ. © 2011 Elsevier B.V. All rights reserved.
Keywords: Interconnection networks Locally twisted cubes Broadcast algorithm Optimal broadcast tree
1. Introduction When a parallel algorithm is executed on a parallel computer with distributed memory, it is necessary to exchange data between the processors through the underlying interconnection network. Due to the fact that the interprocessor communication time is usually substantial relative to the time needed exclusively for computations, it is important to carry out the information exchange as efficiently as possible. In this context, the efficient broadcast over an interconnection network (i.e., the same set of data is required to be sent from a given node, called the source node, to all other nodes of the network) is a central issue [5]. The n-dimensional locally twisted cube, LTQ n , is a variant of n-dimensional hypercube proposed by Yang et al. [8]. Due to a number of remarkable advantages over the hypercube and some of its classical variants, the locally twisted cubes have received considerable interest [9,4,6,7, 2,1,3]. Although algorithms presented in [2,3] can be applied to solve the single node broadcast problem in locally twisted cubes, the already existing methods fail to execute
*
Corresponding author. E-mail address:
[email protected] (L. Wang).
0020-0190/$ – see front matter doi:10.1016/j.ipl.2011.11.003
© 2011
Elsevier B.V. All rights reserved.
the communication task in the minimum possible number of transmission steps, which don’t take advantage of that the diameter of LTQ n is only about half of the diameter of n-dimensional hypercube network. Hence, this paper proposes an optimal broadcast algorithm in sense of transmission steps over a locally twisted cube. This paper is devoted to the study of optimal broadcast strategy over a locally twisted cube. We adopt the multiple link availability (MLA, for short) assumption, that is, all incident links of a node can be used simultaneously for the information transmission and reception. In our algorithm, the information is routed through a broadcast tree rooted at the source node. First, we describe a new broadcast tree construction algorithm. We then prove that the broadcast tree is optimal in terms of the number of communication steps. The rest of this paper is organized as follows. Section 2 gives the preliminary knowledge. Section 3 proposes a new broadcast tree construction algorithm, which in Section 4 is analyzed and proved to be optimal. The final section contains our concluding remarks. 2. Preliminary knowledge For our purpose, an interconnection network will be represented by a graph G = ( V (G ), E (G )), where nodes
130
X. Yang et al. / Information Processing Letters 112 (2012) 129–134
Fig. 1. Two small-sized locally twisted cubes.
and edges represent processors and communication links between processors, respectively. For fundamental graphtheoretic terminology, see Ref. [10]. Let d G (x, y ) or simply d(x, y ) denote the distance between two nodes x and y of graph G, and let diam(G ) denote the diameter of graph G. A multiple set is a collection of items in which some items may appear more than once. For convenience, let S and S ∗ denote a set and a multiple set, respectively. Let {0, 1}n denote the set of all 0–1 binary strings of length n. Let 0n (resp. 1n ) denote a string consisting of n 0s (resp. n 1s). For two binary strings x and y ∈ {0, 1}n , let x + y denote the binary string obtained by carrying out the bitwise exclusive-or operation on x and y. The set {0, 1}n with respect to the operation ‘+’ constitutes a linear space, denoted ({0, 1}n , +). 2.1. Locally twisted cube Definition 2.1. (See [8, Definition 2.1].) For n 2, an ndimensional locally twisted cube, LTQ n , is defined in the following recursive way: (1) LTQ 2 is a graph with four nodes, 00, 01, 10, and 11, connected by four edges {00, 01}, {01, 11}, {11, 10}, and {10, 00}. (2) For n 3, LTQ n is built this way: let 0LTQ n−1 (respectively, 1LTQ n−1 ) denote a copy of LTQ n−1 by preceding the label of each node with 0 (respectively, 1), then connect each node 0x2 x3 · · · xn of 0LTQ n−1 to the node 1(x2 + xn )x3 · · · xn of 1LTQ n−1 by an edge. From the definition one can see that two nodes x = x1 x2 · · · xn and y = y 1 y 2 · · · yn of LTQ n are adjacent if and only if either (a) x and y differ in the kth bit, xk+1 = yk+1 + xn for some 1 k n − 2, and xr = y r for all the remaining bits, or (b) x and y differ in the kth bit for some k ∈ {n − 1, n}, and xr = y r for all the remaining bits. Fig. 1 depicts two small-sized locally twisted cubes.
2.2. Some algebra on locally twisted cubes Given an integer n 2. For every integer 1 i n, let e i denote the binary string of length n with the ith bit being 1 and all the remaining bits being 0. That is,
e 1 = 1000 · · · 00, e 3 = 0010 · · · 00,
e 2 = 0100 · · · 00,
...,
en = 0000 · · · 01.
The set eBASEn = {e i : 1 i n} forms a base of space ({0, 1}n , +) and is called its e-base. A string in eBASEn is called an e-base string. For every integer 1 i n − 2, let E i denote the binary string of length n with both the ith bit and the (i + 1)th bit being 1 and all the remaining bits being 0. In addition, let E n−1 = en−1 and E n = en . That is,
E 1 = 1100 · · · 00, E 3 = 0011 · · · 00,
E 2 = 0110 · · · 00,
...,
E n−1 = 0000 · · · 10,
E n = 0000 · · · 01. The set EBASEn = { E i : 1 i n} forms a base of ({0, 1}n , +) and is called its E-base. A string in EBASEn is called an Ebase string. The set BASEn = eBASEn ∪ EBASEn forms a redundant base of ({0, 1}n , +), which is called its base. A string in BASEn is called a base string. Definition 2.2. (See [8, Definition 3.1].) Let x ∈ {0, 1}n . (1) An e-expansion (E-expansion, expansion) of x is a multiple set of e-base strings (E-base strings, base strings) such that x equals the sum of all the strings in the multiple set. (2) A minimal e-expansion (minimal E-expansion, minimal expansion) of x is an e-expansion (E-expansion, expansion) of x of the minimum cardinality. Theorem 2.3. (See [8, Corollary 3.3].) The minimal expansion (minimal e-expansion, minimal E-expansion) of x ∈ {0, 1}n is a set.
X. Yang et al. / Information Processing Letters 112 (2012) 129–134
In [8], three greedy algorithms have been presented for finding a minimal expansion, minimal e-expansion, and minimal E-expansion of x ∈ {0, 1}n , respectively. In this paper, let SCAN(x) (e_SCAN(x), E_SCAN(x)) denote a minimal expansion (a minimal e-expansion, a minimal Eexpansion) of x ∈ {0, 1}n . Clearly, we have
e_SCAN(x) SCAN(x),
E_SCAN(x) SCAN(x).
Let x and y be two nodes of LTQ n . An edge (x, x + e i )((x, x + E i )) is called with the symbol e i ( E i ). An edge with a symbol e i ( E i ) is called an e-edge (E-edge). A path that consists only of e-edges (E-edges) is called an e-path (E-path). The e-distance (E-distance) between x and y, denoted by de (x, y )(de (x, y )), is the shortest length of an e-path (E-path) between x and y. Lemma 2.4. (See [8, Lemma 3.10].) Let x and y be two nodes of LTQ n . Then
d(x, y ) SCAN(x + y ),
de (x, y ) e_SCAN(x + y ),
d E (x, y ) E_SCAN(x + y ). 3. A broadcast tree construction algorithm In this section, we propose Algorithm Gen_LTQ_BT, which generates a broadcast tree for LTQ n . We suppose that the information should be sent from the source node x to all other nodes. Let x∗ denote the current node and Parent(x∗ ) be the parent node of x∗ which sends the information to x∗ . Fig. 2 shows how Gen_LTQ_BT is applied to two locally twisted cubes. Lemma 3.2. Algorithm Gen_LTQ_BT constructs a spanning tree of LTQ n rooted at the source node where n 2. Proof. By the Gen_LTQ_BT algorithm, it is obvious that each node of LTQ n except the source node has a unique parent. Let x denote the source node and x∗ ∈ V (LTQ n ) − {x} be an arbitrary node. Then we shall prove that there is a unique path from x∗ to x. We consider two cases according to the value of xn as follows.
131
Algorithm 3.1 Gen_LTQ_BT Input: source node, x = x1 x2 x3 · · · xn ; set of nodes on the LTQ n , V (LTQ n ). Output: a broadcast tree for LTQ n 1. For each x∗ ∈ V (LTQ n ) − {x}:{ 2. case (xn , xn∗ ) = (0, 0):{ 3. if |e_SCAN(x∗ + x)| |SCAN(x∗ + x)| + 2 then /* the e-path from x∗ to x is shortest */ 4. i = max{ j | e j ∈ e_SCAN(x∗ + x)}; 5. else i = n; 6. Parent(x∗ ) := x∗ + e i ;} 7. case (xn , xn∗ ) = (0, 1):{ 8. if |e_SCAN(x∗ + x)| = |SCAN(x∗ + x)| then /* the e-path from x∗ to x is shortest */ 9. i = n; 10. else i = max{ j | E j ∈ SCAN(x∗ + x) ∩ j n − 2}; 11. Parent(x∗ ) := x∗ + E i ;} 12. case (xn , xn∗ ) = (1, 1):{ 13. if | E_SCAN(x∗ + x)| |SCAN(x∗ + x)| + 2 then /* the E-path from x∗ to x is shortest */ 14. i = max{ j | E j ∈ E_SCAN(x∗ + x)}; 15. else i = n; 16. Parent(x∗ ) := x∗ + E i ;} 17. case (xn , xn∗ ) = (1, 0):{ 18. if | E_SCAN(x∗ + x)| = |SCAN(x∗ + x)| then /* the E-path from x∗ to x is shortest */ 19. i = n; 20. else i = max{ j | e j ∈ SCAN(x∗ + x) ∩ j n − 2}; 21. Parent(x∗ ) := x∗ + e i ;}
Case 1. xn = 0. We divide this case into four subcases. Then we deal with the four possibilities separately. Subcase 1.1. xn∗ = 0 and |e_SCAN(x∗ + x)| |SCAN(x∗ + x)| + 2. By lines 3, 4 and 6 of the algorithm, x∗ has a unique parent. Let p (1) = Parent(x∗ ) = x∗ + e i (1) where i (1) = max{ j |
e j ∈ e_SCAN(x∗ + x)}. Obviously, pn = 0. If p (1) = x, we are done. Hence, x∗ → x (= p (1) ) is a unique path from x∗ to x. Otherwise, e i (1) ∈ e_SCAN(x∗ + x). Then (1)
e_SCAN x∗ + x + e i (1) = e_SCAN x∗ + x − {e i (1) } and
e_SCAN x∗ + x + e i (1) = e_SCAN(x∗ + x) − 1. On the other hand, E i (1)−1 or e i (1) is inSCAN(x∗ + x). Then
Fig. 2. (a) x = 000 and Gen_LTQ_BT is applied to LTQ 3 , (b) x = 0001 and Gen_LTQ_BT is applied to LTQ 4 .
132
X. Yang et al. / Information Processing Letters 112 (2012) 129–134
SCAN x∗ + x + e i (1) = SCAN x∗ + x or SCAN x∗ + x − 1. Therefore,
e_SCAN x∗ + e i (1) + x SCAN x∗ + e i (1) + x + 2. (1)
By the discussion above, pn = 0 and |e_SCAN( p (1) + x)| |SCAN( p (1) + x)| + 2. Similarly as x∗ , p (1) has a unique parent. Let p (2) = Parent( p (1) ) = p (1) + e i (2) where i (2) = max{ j | e j ∈ e_SCAN(x∗ + x) − {e i (1) }}. We repeat this process until p (k) = x. Hence, the unique path from x∗ to x is x∗ → p (1) → · · · → p (k−1) → x (= p (k) ). Subcase 1.2. xn∗ = 1 and |e_SCAN(x∗ + x)| = |SCAN(x∗ + x)|. By lines 8, 9 and 11 of the algorithm, x∗ has a unique parent. Let p (1) = Parent(x∗ ) = x∗ + E n . If p (1) = x, we are done. Hence, x∗ → x (= p (1) ) is a unique path from x∗ to x. Otherwise, E n ∈ e_SCAN(x∗ + x) and E n ∈ SCAN(x∗ + x). So
∗
∗
e_SCAN x + x + E n = e_SCAN x + x − { E n } and
SCAN x∗ + x + E n = SCAN x∗ + x − { E n }. On the other hand,
e_SCAN x∗ + x = SCAN x∗ + x . Therefore, |e_SCAN(x∗ + E n + x)| = |SCAN(x∗ + E n + x)|. (1) Then pn = 0 and |e_SCAN( p (1) + x)| = |SCAN( p (1) + x)| |SCAN( p (1) + x)| + 2. By the argument of Subcase 1.1, the algorithm produces a unique path from p (1) to x. Hence, the unique path from x∗ to x is x∗ → p (1) (= x∗ + E n ) → · · · → x. Subcase 1.3. xn∗ = 1 and |e_SCAN( p (1) + x)| > |SCAN( p (1) + x)|. By lines 10 and 11 of the algorithm, x∗ has a unique parent. Let p (1) = Parent(x∗ ) = x∗ + E i (1) where i (1) = max{ j | E j ∈ SCAN(x∗ + x) ∩ j n − 2}. (1)
Obviously, pn = 0. If |e_SCAN( p (1) + x)| = |SCAN( p (1) + x)|, then by the argument of Subcase 1.2, the algorithm produces a unique path from p (1) to x. Hence, the unique path from x∗ to x is x∗ → p (1) (= x∗ + E i (1) ) → · · · → x. Otherwise, |e_SCAN( p (1) + x)| > |SCAN( p (1) + x)|. Similarly as x∗ , p (1) has a unique parent. Let p (2) = Parent( p (1) ) = p (1) + E i (2) where i (2) = max{ j | E j ∈ SCAN(x∗ + x) − { E i (1) }∩ j n − 2}. We repeat this process until |e_SCAN( p (k) + x)| = |SCAN( p (k) + x)|. By the argument of Subcase 1.2, the algorithm produces a unique path from p (k) to x. Hence, the unique path from x∗ to x is x∗ → p (1) → · · · → p (k) → · · · → x. Subcase 1.4. xn∗ = 0 and |e_SCAN(x∗ + x)| > |SCAN(x∗ + x)| + 2. By lines 5 and 6 of the algorithm, x∗ has a unique parent. Let p (1) = Parent(x∗ ) = x∗ + en . (1) Obviously, pn = 1. en ∈ / SCAN(x∗ + x) and en ∈ / ∗ e_SCAN(x + x). Therefore,
SCAN x∗ + x + en = SCAN x∗ + x + {en } and
e_SCAN x∗ + x + en = e_SCAN x∗ + x + {en }. On the other hand, |e_SCAN(x∗ + x)| > |SCAN(x∗ + x)| + 2. So
e_SCAN x∗ + en + x > SCAN x∗ + en + x + 2. (1)
Then pn = 1 and |e_SCAN( p (1) + x)| > |SCAN( p (1) + x)| + 2 > |SCAN( p (1) + x)|. By the argument of Subcase 1.3, the algorithm produces a path from p (1) to x. Hence, the unique path from x∗ to x is x∗ → p (1) (= x∗ + en ) → · · · → x. By the argument above, for xn = 0, the algorithm produces a path from any other node in LTQ n to x. Case 2. xn = 1. The argument is similar to that for Case 1. We complete the proof. Example 3.3. We consider the source node 00000000 and the node 11111110 of LTQ 8 . Let x = 00000000(0) and x∗ = 11111110(254).
SCAN x + x∗ = { E 1 , E 3 , E 5 , E 7 } and
e_SCAN x + x∗ = {e 1 , e 2 , e 3 , e 4 , e 5 , e 6 , e 7 }. So |e_SCAN(x∗ + x)| > |SCAN(x∗ + x)| + 2. Process 1: By Subcase 1.4, p (1) = Parent(x∗ ) = x∗ + en = 11111111(255). Process 2: By Subcase 1.3, p (2) = Parent( p (1) ) = p (1) + E 5 = 11110011(243), Process 3: By Subcase 1.3, p (3) = Parent( p (2) ) = p (2) + E 3 = 11110011(195), Process 4: By Subcase 1.3, p (4) = Parent( p (3) ) = p (3) + E 1 = 00000011(3). Process 5: By Subcase 1.2, p (5) = Parent( p (4) ) = p (4) + E n = 00000010(2). Process 6: By Subcase 1.1, p (6) = Parent( p (5) ) = p (5) + e 7 = 00000000(0). Fig. 3 shows how Gen_LTQ_BT constructs the unique path from 254 to 0 in LTQ 8 . This lemma shows that the proposed algorithm can indeed construct a broadcast tree. 4. The optimality and quality analysis of the proposed algorithm 4.1. The optimality of the proposed algorithm In this section we prove the optimality of the previous algorithm. Theorem 4.1. Algorithm Gen_LTQ_BT when applied to LTQ n produces a shortest path from the source to every other node.
X. Yang et al. / Information Processing Letters 112 (2012) 129–134
133
Fig. 3. The unique path from 254 to 0 in LTQ 8 is constructed by Gen_LTQ_BT.
Proof. Let x be the source node. Let x∗ be any node in LTQ n and x∗ = x. By Lemma 3.2, the Gen_LTQ_BT can produce a path from x to x∗ . Let Path(x, x∗ ) denote the path. And we want to prove that Path(x, x∗ ) is the shortest between x and x∗ . Case 1. (xn , xn∗ ) = (0, 1). By Lemma 2.4, d(x, x∗ ) |SCAN(x + x∗ )|. On the other hand, according to the argument for Lemma 3.2, Path(x, x∗ ) is a path of length |SCAN(x + x∗ )|. So Path(x, x∗ ) is the shortest. Case 2. (xn , xn∗ ) = (1, 0). The proof is similar to that for Case 1. Case 3. (xn , xn∗ ) = (0, 0). Let S_Path(x, x∗ ) be a shortest path from x to x∗ . We consider two possibilities: Subcase 3.1. S_Path(x, x∗ ) contains at least one edge with symbol en . Then S_Path(x, x∗ ) contains at least two edges with symbol en . Let C ∗ denote the collection of all the edges on S_Path(x, x∗ ) but the edges with symbol en . Then C ∗ forms an expansion of (x + x∗ ). According to Lemma 2.4, we have
d x, x∗ = Length S_Path x, x∗
SCAN x + x∗ + 2.
C ∗ + 2
Subcase 3.2. S_Path(x, x∗ ) contains no edge with symbol en . Then S_Path(x, x∗ ) is an e-path. Let C ∗ denote the collection of all the edges on S_Path(x, x∗ ). Then C ∗ forms an e-expansion of (x + x∗ ). According to Lemma 2.4, we have
d x, x∗ = Length S_Path x, x∗
e_SCAN x + x∗ .
C ∗
d x, x∗ min SCAN x + x∗ + 2, e_SCAN x + x∗ . On the other hand,
Length P x, x∗
min SCAN x + x∗ + 2, e_SCAN x + x∗ .
Hence, Path(x, x∗ ) is the shortest path.
4.2. The quality analysis of the proposed algorithm Theorem 4.2. Algorithm Gen_LTQ_BT generates an optimal broadcast tree of LTQ n in time O ( N log N ) where N = 2n is the number of the nodes in LTQ n . In particular, the algorithm can be parallelized to run in O (log N ) time. Proof. Let N = 2n denote the number of nodes in LTQ n . We analyze the execution time for the algorithm. In [8], the greedy algorithms presented for finding SCAN(x), e_SCAN(x) and E_SCAN(x) of x ∈ {0, 1}n can run in O (n) = O (log N ). Note that each execution of lines 2–21 in the loop spends O (log N ). On the other hand, | V (LTQ n )| = 2n = N. So the loop (lines 1–21) runs O ( N ) times. Thus, the execution of Algorithm Gen_LTQ_BT needs O ( N log N ). Particularly, the loop can be easily parallelized, which means that the algorithm can be carried out in O (log N ) time. By the previous analysis, algorithm Gen_LTQ_BT when applied on LTQ n can construct an optimal broadcast tree. Clearly, to solve the single node broadcast problem, it is sufficient to transmit the information along the optimal broadcast tree produced by algorithm Gen_LTQ_BT. It requires (2n − 1) link transmissions. This is optimal, since each of the other (2n − 1) nodes must receive the information from the source node. The number of time steps equals the diameter of LTQ n , which is also optimal. In [8], the diameter of LTQ n has been presented. And the single node broadcast using the optimal broadcast tree on LTQ n , for n 5, requires only (n + 3)/2 transmission steps while it for a hypercube requires at least n time steps. 2 5. Concluding remarks
From these discussions, we deduce that
Case 4. (xn , xn∗ ) = (1, 1). The proof is similar to that for Case 3. 2
We have proposed a broadcast tree construction algorithm for locally twisted cubes, which can run in time O ( N log N ) where N = 2n is the number of the nodes in the locally twisted cube. Next, the algorithm is applied to solve the single node broadcast problem for locally twisted cubes and has been proved to be optimal; it executes the required communication task in the minimum possible number of transmission steps and link transmissions. Our next work includes developing multicast and personalized routing algorithms for locally twisted cubes.
134
X. Yang et al. / Information Processing Letters 112 (2012) 129–134
Acknowledgements This work is financially supported by NSFC (Grant No. 10771227). The authors would like to express the gratitude to the anonymous referees for their kind suggestions and careful corrections that helped improve the original manuscript. References [1] Y.J. Han, J.X. Fan, S.K. Zhang, J.W. Yang, P.D. Qian, Embedding meshes into locally twisted cubes, Information Sciences 180 (19) (2010) 3794–3805. [2] S.Y. Hsieh, C.J. Tu, Constructing edge-disjoint spanning trees in locally twisted cubes, Theoretical Computer Science 410 (8) (2009) 926–932.
[3] J.C. Lin, J.S. Yang, C.C. Hsu, J.M. Chang, Independent spanning trees vs edge-disjoint spanning trees in locally twisted cubes, Information Processing Letters 110 (10) (2010) 414–419. [4] M.J. Ma, J.M. Xu, Panconnectivity of locally twisted cubes, Applied Mathematics Letters 19 (7) (2006) 673–677. [5] B. Parhami, Introduction to Parallel Processing: Algorithms and Architectures, Plenum, New York, 1999. [6] W.W. Wang, M.J. Ma, J.M. Xu, Fault-tolerant pancyclicity of augmented cubes, Information Processing Letters 103 (2) (2007) 52–56. [7] J.M. Xu, Q. Zhu, M. Xu, Fault-tolerant analysis of a class of networks, Information Processing Letters 103 (6) (2007) 222–226. [8] X.F. Yang, D.J. Evans, G.M. Megson, The locally twisted cubes, International Journal of Computer Mathematics 82 (4) (2005) 401– 413. [9] X.F. Yang, G.M. Megson, D.J. Evans, Locally twisted cubes are 4-pancyclic, Applied Mathematics Letters 17 (8) (2004) 919–925. [10] F. Harary, Graph Theory, Addison-Wesley, Reading, MA, 1969.