Direct routing on trees - Semantic Scholar

Report 1 Downloads 131 Views
Direct routing on trees extended abstract

Stephen Alstrup Jacob Holm Kristian de Lichtenberg Mikkel Thorup Abstract

advantage of only needing linear information for the schedules. For each packet we only need to know its start time and its destination. That is, the total size of a direct tree routing schedule is O(n) as opposed to (n2 ) bits for general schedules. The possible drawback of direct tree routing is that it may not complete as quickly as a general schedule. However, Symvonis [29] has shown that given a tree with n nodes and a permutation , he can, in O(n3 ) time, construct a direct tree routing schedule which is guaranteed to complete in n ? 1 time steps. Note that n ? 1 is optimal even for general schedules, for if the tree is a path, a packet moving between its endpoints needs to move n ? 1 times. Unfortunately, the O(n3 ) construction time may be prohibitive for large networks. In this paper, we identify a di erent direct tree routing schedule that is also guaranteed to complete in n ? 1 steps, but which we can construct in O(n log n log log n) expected time and in O(n log n(log log n)2 ) worst case time. Thus ecient direct tree routing (hot-potato) schedules can now be constructed in near-linear time. This should be contrasted with the situation for general schedules, where just the (n2 ) size of the schedule prohibits a sub-quadratic construction time. Whereas the node capacity (the maximum number of a packets arriving at a node in one step) in Symvonis schedule was only limited by the general degree bound for hot-potato routing, the schedule in this paper respects node capacity two. This is clearly optimal for routing in n ? 1 steps, for if the tree is a path with an odd number of nodes and the packets at the endpoints should be exchanged, the packets have to meet in the middle node. Finally, on the individual packet level, we note that the schedule presented in this paper guarantees that any given packet arrives at its destination within d + k steps, where d is the length of its route and k is the maximum number of other routes intersecting its route in a single node. To contextualize our problem within the border literature [17], packet routing has been the source of intensive studies. Several models have been considered, but, as in our paper, most papers (see e.g. [7, 12, 14, 18, 19, 24, 25, 26, 31]) consider the model in which, at each time step, each edge can carry one

We consider o -line permutation routing on trees. We are particularly interested in direct tree routing schedules where packets once started move directly towards their destination. The scheduling of start times ascertains that no two packets will use the same edge in the same direction in the same time step. In O(n log n log log n) time and O(n log n) space, we construct a direct tree routing schedule guaranteed to complete the routing within the general optimum of n ? 1 steps. In addition, our scheme guarantees that at most two packets arrive at the same node in the same time step. Furthermore, if the length of the route of a given packet is d and the maximum number of other routes intersecting the route in a single node is k then the packet arrives to its destination within d + k steps.

1 Introduction

In this paper, we consider o -line hot-potato permutation packet routing on trees. We are given a permutation  of the nodes, and for each node v, we want to send a packet from v to (v). At each step, one packet can move along each edge in both directions. Our task is to nd a schedule for the moves, so as to complete the routing as quickly as possible. We are particularly interested in direct tree routing schedules, which is a simple case of hot-potato routing in trees, where packets once started move directly towards their destination. The scheduling of start times must ascertain that no two packets will use the same edge in the same direction in the same time step. Such simple schedules have many obvious advantages over general schedules. First we have the general advantages of hot potato routing: The switching technology of the nodes is simple in that we do not need to deal with waiting packets. Moreover, the maximal number of packets arriving at a node in a time step (excluding a packet starting or ending there) is bounded by its degree. In particular for bounded degree networks, this immediately bounds the packet capacity needed for the nodes. For direct tree routing, we further have the  E-mail:(stephen,samson,morat,mthorup)@diku.dk.

ment of Computer Science, University of Copenhagen.

Depart-

1

2 packet in each direction. O -line construction of routing schedules has been a subject of several papers (see e.g. [1, 3, 16, 27, 29, 30, 33]). O -line constructions do have direct applications in industry [8, 17, 30], but they are also investigated to examine the possibility of constructing on-line solutions [15]. Hot-potato routing schemes, as studied in this paper, have been considered for more than thirty years [5], and the running times of hot-potato routing schemes have more recently been studied in various networks [4, 6, 10, 13, 29]. Trees have always been a subject of special interest in the routing literature (see e.g. [1, 33, 27, 28, 29, 16, 20, 22, 23]). As pointed out by Leighton [17], many networks are simply trees, and, moreover, routing in general graphs may be done using only the edges of a spanning tree of the graph. As mentioned above, our contribution is a near linear construction of direct (hot-potato) routing schemes for trees that always route within the n ? 1 steps, which is the general optimum for tree routing. Furthermore our scheme respects node capacity two. To our knowledge no previous hot-potato scheme achieves a constant node capacity. Our direct tree routing should be compared with recent work on o -line matching routing [1, 27, 33]. In matching routing, in each time step, a set of edges with disjoint endpoints (i.e. a matching) is chosen, and then for each selected edge the packets on the endpoints are exchanged. The model has the immediate advantage that the maximal number of packets at any node is constant, but recall that this is also achieved for our particular schedules. As shown in [1], in the matching model there are permutations on trees needing at least 3=2 n steps. This lower bound was recently complemented by a 3=2 n + O(log n) upper bound for trees [33]. Nevertheless, the 3=2 n lower-bound for the matching model is worse than the n ? 1 upper-bound we achieve in the direct tree routing model. Finally, recall that in the direct tree routing model, we only need to store the starting time for each packet. In contrast, in the matching model, we need to store a matching for each step. Thus, matching schedules need quadratic information while the direct tree routing schedule need only linear information. All in all it seems our particular direct tree routing schedules are superior to matching routing schedules. In [29] it is further claimed that direct routing schemes are those that best t the possibilities of todays technology. The paper is organized as follows. In section 2 preliminaries are given. In section 3 we give an order in which the packets should be assigned a start time, such that the ecient algorithm in section 4 can be applied.

2 Preliminaries

First we examine under which circumstances a con ict can arise. By a con ict we mean that two packets will use the same edge at the same time in the same direction. If two packets p and q do not use any edge in the same direction, the packets can have no con ict and the start times for p and q can be chosen independently. Therefore, assume the packets p and q use an edge e in the same direction. If the start times for p and q are chosen such that the they will use the edge e at di erent times, then p and q will use all the edges on the common path at di erent times (recall that in each step, all packets which have started and have not yet reached the destination, will move on). Formally, for two packets p and q: If p and q has a common directed path, we de ne timedif(p; q) = i, such that the packets will be in con ict if and only if the packet p's start time is precisely i time steps later than packet q's start time, ?n < i < n. Otherwise p and q cannot have a con ict and we de ne timedif(p; q) = NONE . In order to compute timedif for two packets we preprocess the tree as follows. First we choose an arbitrary node to be the root of the tree. Next we use the linear time preprocessing algorithm due to Harel and Tarjan [11] such that the nearest common ancestor, nca, of two nodes in the rooted tree can be found in constant time. This makes it possible to determine the rst node on the common directed path two di erent packets share, if such a path exists. Using this node and the di erence in distance from the two packets to the node we can in constant time determine timedif for the packets. Lemma 2.1. For any two packets p 6= q we can compute timedif(p; q) in constant time, given the ability of linear time and space for preprocessing. Proof. For three nodes c1 ; c2 and c3 in a tree, let meet(c1 ; c2 ; c3 ) be the unique node on all three paths c1    c2 ; c1    c3 and c2    c3 in the tree. Let a1    a2 and b1    b2 be the two packet paths, starting in a1 and b1 respectively. If meet(a1 ; a2 ; b1 ) 6= meet(b1; b2 ; a1 ) then either the two paths does not share any nodes or they use the common path in opposite directions, and so timedif(p; q) = NONE . So let d = meet(a1 ; a2 ; b1 ) = meet(b1; b2 ; a1 ). In this case d will be the rst node on a1    a2 that you get to from b1 and d will also be the rst node you get to from a1 going to b1    b2. Thus, they can have a con ict if and only if they share an edge going out of d. This is the case if and only if meet(d; a2; b2 ) 6= d, that is i d 62 a2    b2 . If they can have a con ict, then timedif is equal to dist(a1 ; d) ? dist(b1; d). The distance between two nodes in a rooted tree is computed as

3

dist(a; b) = depth(a) + depth(b) ? 2  depth(nca(a; b)). O(n2 ) time. However by only using linear time prepro-

So timedif can be computed using a constant number of nca, dist and meet operations. We now show that meet can be computed using 3 nca operations, thus timedif can be computed in constant time after a linear preprocessing for nca [11] and depth. Let c1 ; c2 and c3 be nodes in a tree and let d12 = nca(c1 ; c2 ), d13 = nca(c1 ; c3 ) and d23 = nca(c2 ; c3 ). Then at least two of the nodes d12 , d13 and d23 are identical and meet(c1 ; c2 ; c3 ) is the third. If d12 = d13 = d23 then this is trivially true. So assume w.l.o.g. d12 6= d13 and depth(d13 ) < depth(d12 ). Now since both d12 and d13 are ancestors of c1 then d13 must be an ancestor of d12 . But this means that d13 is an ancestor of c2 and d23 = d13 , thus two nodes are identical, and meet(c1; c2 ; c3 ) = d12 , being the node on all three paths. Thus meet can be computed using 3 nca operations as stated. 2

cessing we can still answer such queries in constant time. To do this we combine the above mentioned standard techniques for trees with the linear time preprocessing algorithm from [9], such that level ancestor queries can be answered in constant time. The level ancestor(v; i) is de ned as the i'th ancestor to the node v.

Proposition 2.2. A tree can in linear time be prepro-

cessed such that in constant time it is possible given two nodes a and b to determine the rst node on the path from a to b not including a.

Proof. The tree is preprocessed in linear time using the results from [9, 11] and the depth of each node in the rooted tree are computed. Now a query is computed as follows: If nca(a; b) 6= a the next node is the parent of a in the rooted tree. Otherwise determine the child of a in the tree which also is an ancestor to the node b, by Symvonis [29] consider a certain type of greedy computing level ancestor(b; depth(b) ? depth(a) ? 1). 2 schedules. Given any ordering P = p1 ; : : : ; pn of the packets, we have greedy schedule de ned as follows. For 3 Determining an order of the packets i = 1; : : : ; n, we give packet pi the rst start time that In this section we de ne a class of orders, called does not cause a con ict with any packet ph , h < i. orders, for assigning start times to the packets (still Proposition 2.1. Given any ordering we can identify assuming that the rst possible start time is assigned to a packet when it is processed). As the order from [29], the associated greedy schedule in O(n2 ) time. the -orders guarantee that at most n ? 1 steps are used Proof. When assigning a packet pi a start time we to route the packets, but it has three advantages. A  rst initialize a table of the n possible start times. order can be computed in linear time and it is chosen Next we for each packet ph , h < i, use timedif(pi ; ph) such that we can eciently determine the start times as to exclude at most one time from the table. Finally we will show in the next section. Furthermore it makes the best possible time can be found in linear time, it possible to limit the node capacity to two. From now by looking up in the table. For each packet we use on we assume our tree is rooted in an arbitrary node. timedif at most O(n) times and since timedif can be For a packet p let top(p) = nca(orig(p); dest(p)) be the computed in constant time according to lemma 2.1 the unique node of least depth on the packets path. time complexity is established. 2 Definition 3.1. Associate with each packet p the pair 2 Symvonis [29] show how one in O(n ) time can (px; py ) = (depth(top(p)); depth(orig(p))). A -order compute an order of the packets, such that the greedy is then an order