# Parallel Breadth-first and Breadth-depth traversals of general trees

## Abstract

Two adaptive, level-order tree traversal algorithms are proposed for an exclusive-read and exclusive-write (EREW), parallel random access machine (PRAM) model of computation. Our breadth-first traversal algorithm for a general tree with n nodes achieves O((n/p)*log n /log(n/p)) time complexity using p processors on the EREW model, and hence it attains optimal speedup for p ≤ n^{1 − e}, where 0 < e ≤ 1. This algorithm performs better (in terms of processor-time product) than an existing algorithm [12] which has O(k log n) time complexity using O(n^{1 + 1/k}) processors on a concurrent-read and exclusive-write (CREW), PRAM model. The proposed breadth-depth algorithm for traversing a general tree requires O(n/p + log n) time on the EREW model, and thus it achieves optimal speedup for p ≤ n/log n. This algorithm provides a significant improvement over an existing parallel breadth-depth algorithm [4] which requires O(log n) time with O(n^{2}) processors on CREW model. Our breadth-first traversal algorithm uses an Euler tour technique [20], and a list construction technique which is similar to the one used in [18] for solving the adjacency list construction problem for graphs. The breadth-depth traversal algorithm, on the other hand, is based on a special characterization which enables the reduction of this problem into a variety of list ranking problems.

## Key words

Tree traversal Linked list ranking Breadth-first search Breadth-depth search Parallel algorithm Optimal speedup## Preview

Unable to display preview. Download preview PDF.

## References

- [1]A.V. Aho, J.E. Hopcroft and J.D. Ullman,
*Data Structures and Algorithms*(Addison-Wesley, Reading, Mass., 1983).Google Scholar - [2]A. Berztiss, "A Taxonomy of Binary Tree Traversals",
*BIT*, Vol. 20, 1986, pp. 266–276.Google Scholar - [3]R.P. Brent, "The Parallel Evaluation of General Arithmetic Expressions",
*J. ACM*, Vol. 21, No. 2, Apr. 1974, pp. 201–206.Google Scholar - [4]P. Chaudhuri, "Fast Parallel Graph Searching with Applications",
*BIT*, Vol. 28, 1988, pp. 2–18.Google Scholar - [5]C. C-Y. Chen and S. K. Das, "Parallel Algorithms for Level-Order Traversals in General Trees", Tech. Rep., #N-89-005, Dept. Computer Science, Univ. North Texas, Denton, TX, Aug. 1989.Google Scholar
- [6]C. C-Y. Chen and S. K. Das, "On Traversing Trees in Parallel", Tech. Rep., #N-89-006, Dept. Computer Science, Univ. North Texas, Denton, TX, Sep. 1989.Google Scholar
- [7]C. C-Y. Chen, S. K. Das, and S. G. Akl, "A Unified Approach to Parallel Depth-First Traversals of General Trees", Tech. Rep., #N-90-004, Dept. Computer Science, Univ. North Texas, Denton, TX, Mar. 1990.Google Scholar
- [8]R. Cole and U. Vishkin, "Approximate Parallel Scheduling. Part I: The Basic Technique With Applications To Optimal Parallel List Ranking in Logarithmic Time",
*SIAM J. Comput.*, Vol. 17, No. 1, Feb. 1988, pp. 128–142.Google Scholar - [9]R. Cole and U. Vishkin, "The Accelerated Centroid Decomposition Technique for Optimal Parallel Tree Evaluation in Logarithmic Time", Courant Institute Tech. Rep. 242, New York University, New York, 1986.Google Scholar
- [10]R. Cole and U. Vishkin, "Deterministic Coin Tossing with Applications to Optimal Parallel List Ranking",
*Information and Control*, Vol. 70, 1986, pp. 32–53.Google Scholar - [11]S. K. Das and N. Deo, "Divide-and-Conquer-Based Optimal Parallel Algorithms for Some Graph Problems on EREW PRAM model",
*IEEE Transactions on Circuits and Systems*, Vol.35, No. 3, Mar. 1988, pp. 312–322.Google Scholar - [12]R. K. Ghosh and G.P. Bhattacharjee, "Parallel Breadth-First Search Algorithms for Trees and Graphs",
*Intern. J. Computer Math.*, Vol. 15, 1984, pp. 255–268.Google Scholar - [13]R.K. Ghosh and G.P. Bhattacharjee, "A Parallel Search Algorithm for Directed Acyclic Graphs",
*BIT*, Vol. 24, 1984, pp. 134–150.Google Scholar - [14]E. Horowitz and S. Sahni,
*Fundamentals of Data Structures*(Computer Science Press., Rockville, Maryland, 1977).Google Scholar - [15]N.C. Kalra and P.C.P. Bhatt, "Parallel Algorithms for Tree Traversals",
*Parallel Computing*, Vol. 2, 1985, pp. 163–171.Google Scholar - [16]R. M. Karp and V. Ramachandran, "A Survey of Parallel Algorithms for Shared-Memory Machines", Computer Science Division (EECS) Rep. UCB/CSD 88/408, Mar. 1988, University of California, Berkeley, CA.Google Scholar
- [17]D.E. Knuth,
*The Art of Computer Programming. Vol. 1, Fundamental Algorithms*(Addison Wesley, Reading, Mass. 1973).Google Scholar - [18]C.P. Kruskal, L. Rudolph, and M. Snir, "Efficient Parallel Algorithms for Graph Problems",
*Proc. International Conference on Parallel Processing*, 1986, pp. 869–876.Google Scholar - [19]G. Miller and J. H. Reif, "Parallel Tree Contraction and Its Application",
*Proc. 26th Annual IEEE Symposium on Foundations of ComputerScience*, 1985, pp. 478–489.Google Scholar - [20]R. E. Tarjan and U. Vishkin, "An Efficient Parallel Biconnectivity Algorithm",
*SIAM J. Comput.*, Vol. 14, Nov. 1985, pp. 862–874.Google Scholar - [21]J. Wyllie, "The Complexity of Parallel Computations",
*Ph.D. Thesis*, Cornell University, Ithaca, NY, 1979.Google Scholar