chapter 4

10
Chapter 4 Downcasts and Upcasts

Upload: hali

Post on 05-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Chapter 4. Downcasts and Upcasts. 4.1 Downcasts. At first we assume the case where the root has m distinct items A = { m 1 , …, m m }, each destined to one specific vertex in the tree. Lemma 4.1.1 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 4

Chapter 4

Downcasts and Upcasts

Page 2: Chapter 4

4.1 Downcasts• At first we assume the case where the root has m distinct items A = {1, …, m}, each de

stined to one specific vertex in the tree.

• Lemma 4.1.1– Downcasting m distinct messages on T requires(Depth(T)) time in the worst cast for every

tree T.

– Downcasting m distinct messages on arbitrary tree requires (m) time in the worst case.

– To each children of the root simply sends the messages destined to the subtree by one on the edge in arbitrary order.

– And the intermediate vertex in the tree receives at most one message at each step and passes it on.

• Lemma 4.1.2– Algorithm DOWNCAST performs downcasting of m distinct messages on the tree T in time O

(m+Depth(T)).

– Proof is in page 41

Page 3: Chapter 4

4.2 Upcasts• We suppose that m data items A = {1, …, m} are initially stored at some of the vertices

of the tree T. Items can be replicated, namely, each item is stored in one or more vertices.

• Lemma 4.2.1– For every tree T, upcasting m distinct messages on T requires(Depth(T)) time in the worst

cast.

– Upcasting m distinct messages on arbitrary tree requires (m) time in the worst case.

– The upcasting is not the simple convergecast process of downcasting, since the items are sent up to the root individually. In the upcast operation the different messages “converge” to a single spot on the tree, hence they tend to disrupt each other more and more.

– Though at last we know the result that upcast operation can be performed in time m + Depth(T) , the algorithms of it are totally difference from downcast operation.

– Simply “rolling the execution tape backwards” will give us a feasible schedule for the upcast operation

– We give out three possible settings of assumptions regarding the given items.

Page 4: Chapter 4

4.2.1 Ranked items• The first assumptions is the items are taken from an ordered set, and each item is marked

by its rank in the set. (the items are given in the form of pairs (i, such that i i+1 for 1 i m).

• Algorithm RANKED_UPCAST

• Lemma 4.2.2

– If the ith item is Mv, then at the end of round it is stored at v.

– This immediately guarantees that by time Depth(T) + m, all items are collected at the root.

• Corollary 4.2.3– Upcast of m ranked items on a tree T can be performed in time Depth(T) + m.

On round (for every i 1) do If the ith item, (i, ), is stored locally then forward it to parent.

)(vL

1)(

ivL

Page 5: Chapter 4

4.2.2 Ordered items• The second assumptions is the slightly more general case where the items are taken from

an ordered set, but their ranks are not marked.

• It is impossible to tell the position of a particular item in the complete list by inspecting the item and it is possible to compare them and decide which is the larger of the two.

• Algorithm ORDERED_UPCAST

• In this situation, we still can prove Lemma 4.2.2.

• Corollary 4.2.4– Upcast of m ordered items on a tree T can be performed in time Depth(T) + m.

On each round do Forward to parent the smallest locally stored item that has not been upcast so far.

Page 6: Chapter 4

4.2.3 Unrdered items• The third assumptions is the case where the items are entirely incomparable. It is the mo

st general case.• Algorithm UNORDERED_UPCAST

• In this setting, Lemma 4.2.2 no longer holds. We need the following claim.• Lemma 4.2.5 (proof is in page 44)

– Consider a vertex v and an integer t. Suppose that for every 1 i k, at the end of round t+I, v stored at least I items. Then at the end of round t+k+1, v’s parent w has received from v at least k items.

• Lemma 4.2.6 (proof is in page 44)– For ever 1 I |Mv|, at the end of round , at least i items are stored at v.

• Corollary 4.2.7– Upcast of m unordered items on a tree t can be performed in time Depth(T) + m.

On each round do Forward to parent an arbitrary locally stored item that has not been upcast so far.

1)(

ivL

Page 7: Chapter 4

4.3 Applications

• The traditional way to do this is, first, find the minimum element and inform all the vertices by broadcasting it throughout the tree. Then find the next smallest element by the same method and so on. The should take O(kDepth(T)) time.

• An alternative and faster method would be the following. At any given moment along the execution, every vertex keeps the elements it knows of in an ordered list. In each step, each vertex sends to its parent the smallest element that hasn’t been sent yet.

• Lemma 4.3.1– Upcasting the k smallest elements on a tree T can be performed in Depth(T) + k time.

4.3.1 Smallest k-of-m

Page 8: Chapter 4

4.3.2 Information gathering and dissemination• Suppose that m data items are initially stored at some of the vertices of the tree T. Items

can be replicated, namely, each item is stored in one or more vertices.

• The goal is to end up with each vertex knowing all the items.

• The natural way is to collect the items at the root of the tree and then broadcast them one by one.

• We can do upcast operation to collecting the information and downcast operation to broadcast the information to every leaves.

• Hence the total time should be O(m+Depth(T)).

Page 9: Chapter 4

4.3.3 Route-disjoint matching• Suppose we are given a network in the form of a rooted tree T (with each vertex

knowing the edge leading to its parent and the edges leading to its children in T)

• A set of 2k vertices W={w1, …, w2k} for k n/2 is initially marked in the tree.

• Our goal is to find a matching of these vertices into pairs (w i1, wi2) for 1 i k, such that the unique routes Yi connecting wi1, to wi2 in T are all edge-disjoint.

• Lemma 4.3.2– For every tree T and for every set W as above, there exists an edge-disjoint matching as

required.

– Furthermore, this matching can be found by a distributed algorithm on T in time O(Depth(T)).

Page 10: Chapter 4

4.3.4 Token distribution• n token are initially distributed among the n vertices of the tree with no more than K at e

ach site

• The goal is redistributing the tokens so that each processor will have exactly one token.

• The cost of the entire redistribution process equals the sum of the distances traversed by the tokens in their way to their destinations.

• P = uro |pu|, where su is the number of tokens in the subtree Tu, nu is the number of vertices in the subtree Tu, pu = su – nu is the number of token that need to be transferred out of Tu

• Lemma 4.3.3– There exists a distributed algorithm for performing token distribution on a tree using an optim

al number of messages P and O(n) time, after a preprocessing stage requiring O(Depth(T)) time and O(n) messages.