# Chapter 4 Downcasts and Upcasts. 4.1 Downcasts At first we assume the case where the root has m distinct items A = {  1, …,  m }, each destined to one.

## Presentation on theme: "Chapter 4 Downcasts and Upcasts. 4.1 Downcasts At first we assume the case where the root has m distinct items A = {  1, …,  m }, each destined to one."— Presentation transcript:

Chapter 4 Downcasts and Upcasts

4.1 Downcasts At first we assume the case where the root has m distinct items A = {  1, …,  m }, each destined 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

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.

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 M v, 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.

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.

4.2.3 Unrdered items The third assumptions is the case where the items are entirely incomparable. It is the most 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  |M v |, 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.

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

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)).

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={w 1, …, w 2k } for k   n/2  is initially marked in the tree. Our goal is to find a matching of these vertices into pairs (w i1, w i2 ) for 1  i  k, such that the unique routes Y i connecting w i1, to w i2 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)).

4.3.4 Token distribution n token are initially distributed among the n vertices of the tree with no more than K at each 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 =  u  ro |p u |, where s u is the number of tokens in the subtree T u, n u is the number of vertices in the subtree T u, p u = s u – n u is the number of token that need to be transferred out of T u Lemma 4.3.3 –There exists a distributed algorithm for performing token distribution on a tree using an optimal number of messages P and O(n) time, after a preprocessing stage requiring O(Depth(T)) time and O(n) messages.

Download ppt "Chapter 4 Downcasts and Upcasts. 4.1 Downcasts At first we assume the case where the root has m distinct items A = {  1, …,  m }, each destined to one."

Similar presentations
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://slideplayer.com/slide/3215510/", "fetch_time": 1506433028000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2017-39/segments/1505818695726.80/warc/CC-MAIN-20170926122822-20170926142822-00615.warc.gz", "warc_record_offset": 309495366, "warc_record_length": 21669, "token_count": 1809, "char_count": 6936, "score": 3.5625, "int_score": 4, "crawl": "CC-MAIN-2017-39", "snapshot_type": "longest", "language": "en", "language_score": 0.8774994611740112, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00014-of-00064.parquet"}