Parallel Techniques for Construction of Trees and Related Problems
Total Page:16
File Type:pdf, Size:1020Kb
Parallel techniques for construction of trees and related problems By Teresa Maria Przytycka Magister, Warsaw University A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY in THE FACULTY OF GRADUATE STUDIES Department of Computer Science We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA August, 1990 © Teresa Przytycka, 1990 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of CompcU-e^ 2cc'&r? c£ The University of British Columbia Vancouver, Canada DE-6 (2/88) Abstract The concept of a tree has been used in various areas of mathematics for over a century. In particular, trees appear to be one of the most fundamental notions in computer science. Sequential algorithms for trees are generally well studied. Unfortunately many of these sequential algorithms use methods which seem to be inherently sequential. One of the contributions of this thesis is the introduction of several parallel techniques for the construction of various types of trees and the presentation of new parallel tree construction algorithms using these methods. Along with the parallel tree construction techniques presented here, we develop techniques which have broader applications. We use the Parallel Random Access Machine as our model of computation. We consider two basic methods of constructing trecs:tree expansion and tree synthesis. In the tree expansion method, we start with a single vertex and construct a tree by adding nodes of degree one and/or by subdividing edges. We use the parallel tree expansion technique to construct the tree representation for graphs in the family of graphs known as cographs. In the tree synthesis method, we start with a forest of single node subtrees and construct a tree by adding edges or (for rooted trees) by creating parent nodes for some roots of the trees in the forest. We present a family of parallel and sequential algorithms to construct various approximations to the Huffman tree. All these algorithms apply the tree synthesis method by constructing a tree in a level-by-level fashion. To support one of the algorithms in the family we develop a technique which we call the cascading sampling technique. One might suspect that the parallel tree synthesis method can be applied only to trees of polylogarithmic height, but this is not the case.We present a technique which we call the valley filling technique and develop its accelerated version called the accelerated valley filling technique. We present an application of this technique to an optimal parallel algorithm for construction of minimax trees. ii Table of Contents Abstract ii List of Figures vi Acknowledgements viii CHAPTER 1: INTRODUCTION 1 1.1. The Computation Model 2 1.2. Parallel Construction of Trees 5 1.3. A systematic approach to algorithmic problems 8 1.4. Basic definitions and notation 9 CHAPTER 2: BASIC TECHNIQUES FOR DESIGN OF PARALLEL ALGORITHMS 12 2.1. Brent's scheduling principle 12 2.2. Prefix sum computation 13 2.3. List ranking , 15 2.4. Euler tour technique 17 2.5. Tree Contraction 18 2.5.1. A tree contraction algorithm 20 2.5.2. Bottom-up Algebraic Tree Computations 25 2.5.2. Top-down Algebraic Tree Computations 31 2.6. Cascading sampling 32 2.7. Parallel divide and conquer and the All Dominating Neighbors problem 40 iii 2.7.1. The ADN problem and the visibility tree 42 2.7.2. An optimal algorithm for the ADN problem 44 2.7.3. Applications 47 2.7.3.1. The All Strictly Dominating Neighbors (ASDN) problem 49 2.7.3.2. Computing horizontal neighbors for vertices of a monotone polygon 50 2.8. Summary 53 CHAPTER 3: PARALLEL TREE EXPANSION - CONSTRUCTION OF TREE REPRESENTATION FOR COGRAPHS 55 3.1. Definitions and basic properties 57 3.2. Bunches and lines in a cotree 60 3.3. A top level description of the cotree construction algorithm 68 3.4. Implementation of the reduce operation 73 3.5. Adjacency matrix construction from the cotree representation of a cograph 75 3.6. Reduction of the processor requirements 77 3.7. An application of the cotree construction algorithm - construction a tree representation for a parity graph 78 3.8. Summary 80 CHAPTER 4 : PARALLEL LEVEL-BY-LEVEL TREE SYNTHESIS: CONSTRUCTION OF BINARY TREES WITH ALMOST OPTIMAL WEIGHTED PATH LENGTH 82 4.1. Basic Construction Scheme (BC©) 86 4.2. Approximate sorting and merging of approximately sorted sequences 99 4.3. General Construction Scheme (9^/6) 101 iv 4.4. Parallel interpretations of $"5/6 102 4.4.1. 0(log n) time n^°fog^ ^RJ^ processors parallel interpretation of gcs with error bounded by 0.172 103 4.4.2 A 0(klog n log*n) time n processor parallel interpretation of gcs with error bounded by l/n^ 104 4.1.3.0(k2log n) time n2 processor parallel interpretation of gcs with error bounded by 4- 110 4.5. Sequential interpretations of the 9^<^ 121 4.6. Summary 124 CHAPTER 5 : VALLEY FILLING TECHNIQUE AND CONSTRUCTION OF MINIMAX TREES 127 5.1. Valley Filling Technique 130 5.2. Level tree and its construction 132 5.2.1. Construction of level tree 135 5.2.2. Computing the load function 137 5.3. An optimal algorithm for alphabetic minimax tree problem 139 5.4. Other versions of the minimax tree problem 142 5.4.1. t-ary alphabetic minimax trees 142 5.4.2. Non-alphabetic t-ary minimax trees 148 5.4.3. Minimax trees with real weights 153 5.5. Summary 153 CHAPTER 6 : CONCLUDING REMARKS 156 REFERENCES 164 Index 169 v List of figures Figure 2.1. A prefix sum computation 14 Figure 2.2. Prune and Bypass operations 21 Figure 2.3. Interpretation of Trees as Binary Trees 22 Figure 2.4. A tree contraction sequence 24 Figure 2.5. New labelling of edges after Prune and Bypass operations 28 Figure 2.6. Distribution by sampling 39 Figure 2.7. Visibility sequences 43 Figure 2.8. Hidden sequences (bold) 44 Figure 2.9. Hidden sequences (bold lines) 52 Figure 3.1. A cograph and its cotree 60 Figure 3.2. Notation concerning subtrees 60 Figure 3.3. A 0-bunch and a 1-bunch 62 Figure 3.4. Replacing a bunch by its representative 63 Figure 3.5. Relations ZQ(V,U,W) and Zj^u.w) 64 Figure 3.6. Restricting of the possible positions of nodes v,u,w satisfying Z0(v,u,w) 65 Figure 3.7. A nonbranching node 66 Figure 3.8. A 0-line and a 1-line 66 Figure 3.9. Replacing a line by its representative 67 Figure 3.10. A tree containing 3 brunching nodes, 2 bunches and 1 line 68 Figure 3.11. Substitution of fragments for corresponding representatives 70 Figure 3.12. The worst case configuration for case (2) 72 Figure 3.13. Converting a cotree to a binary tree 76 Figure 4.1. The hierarchical data structure used by the n2-processor algorithm 115 vi Figure 4.2. The summary of results of Chapter 4 125 Figure 5.1. A valley filling step 132 Figure 5.2. Level intervals 133 Figure 5.3. Embedded minimax tree 134 Figure 5.4. A level tree 135 Figure 5.5. Introducing the ordering of children 137 Figure 5.6. Binarization of a level tree 138 Figure 5.7. Construction of a balanced forest 139 Figure 5.8. A regular t-ary alphabetic minimax tree and a t-ary alphabetic minimax tree 142 Figure 5.9. Path compaction (t = 5) 145 Figure 5.10: Leaflets compaction (t = 4) 147 Figure 5.11. A stair 150 Figure 5.12. Treads cutting 150 Figure 5.13. Stair climbing 151 Figure 5.14. Cliff climbing 152 Figure 6.1. Generalizations of the parallel dynamic expression evaluation problem 159 vii Acknowledgements First of all, I would like to thank my supervisor, David Kirkpatrick, for his guidance, the support, and the encouragement that he has given me through my years at the University of Biritish Columbia. I had the very good fortune to have studied under his supervision. I am also indebted to Derek Corneil for his guidance and hospitality during may half year visit to the University of Toronto. I would like to extend my gratitude to the members of my committee Feng Gao, Maria Klawe, and Nick Pippenger for their suggestions on ways in which I could improve my presentation. I would like also to thank Jozef, my husband and coauthor of several papers, for his love, encouragement, and introducing me to knot theory, topology, and hyperbolic geometry. Finally I would like to thank all UBC graduate students, faculty, and staff who made my graduate study a rewarding experience. Special thanks to Nou Dadoun and Lisa Higham for many stimulating discussions and reading of various drafts of papers (and translating several of them into English); to Yueli, Jadranka, and Hilde for putting up with me as an office mate. This research has been founded in part by the University of British Columbia Graduate Fellowship, the I.W. Killam Predoctoral Fellowship and the B.C. Advanced Systems Institute Graduate Student Scholarship.