0% found this document useful (0 votes)
62 views11 pages

A Unified Approach To Parallel Depth-First Traversals of General Tree

Uploaded by

api-168623254
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views11 pages

A Unified Approach To Parallel Depth-First Traversals of General Tree

Uploaded by

api-168623254
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

A unified approach to parallel depth-first traversals of general tree

Calvin C.-Y. Chen, Sajal K. Das and Selim G. Akl Information Process Letters, vol. 38, pp.49-55, 1991

2002/2/28


depth-first traversal order

successor function Euler tour Euler tour

1. Cost-optimal 2. Running on a binary or a general tree

3. O(log n) time, O(n / log n) processor, EREW PRAM model

Definition.
1. Pre-order tree traversal 2. Post-order tree traversal

3. In-order tree traversal

NEXT[ xi ] f k 1 c 1 if i no-of chil dren[x] 1 and node x is the kth child of its parent f , where x is not the root, if i no-of chil dren[x] 1 and c is the ith child of x.

Euler tour.

The starting field is a1. NEXT[a1]=b1;NEXT[b1]=a2;NEXT[a2]=c1;NEXT[c1]=e1;NEXT[e1]=c2;

NEXT[c2]=f1;NEXT[f1]=c3;NEXT[c3]=g1;NEXT[g1]=c4;NEXT[c4]=a3;
NEXT[a3]=d1;NEXT[d1]=h1;NEXT[h1]=d2;NEXT[d2]=i1;NEXT[i1]=k1; NEXT[k1]=i2;NEXT[i2]=d3;NEXT[d3]=j1;NEXT[j1]=d4;NEXT[d4]=a4;

1. Pre-order traversal: select the first copy of each node;

2. Post-order traversal: select the last copy of each node;


3. In-order traversal: (a) delete the first copy of each node if it is not a leaf and (b) delete the last copy of each node if it has more than one child.

Euler tour : a1,b1,a2,c1,a3,d1,a4 1. 2. 3.

Euler tour: a1,b1,a2,c1,e1,c2,f1,c3,g1,c4,a3,d1,h1,d2,i1,k1,i2,d3,j1,d4,a4

Pre-order traversal: a1,b1,c1,e1,f1,g1,d1,h1,i1,k1,j1

Post-order traversal: b1,e1,f1,g1,c4,h1,k1,i2,j1,d4,a4


In-order traversal: b1,a2,e1,c2,f1,c3,g1,a3,h1,d2,k1,i2,d3,j1

SUPERNODE: array[1..2n-1] of SNODEREC; for all Pi, 1 <= i <= n do parbegin Step_1 Processor Pi builds jth field of is parent node if node I is the jth child of its parent. The jth field (if it is not the last field) is stored in the ith index of array SUPERNODE. Step_2 Processor Pi builds node is last field whose array index is (n + i). parend.

SNODEREC:

Record
(X)node :integer;

(Y)subscript:integer;//field number (Z)next-idx :integer;//the array index of its successor End.

1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 0 1 2 3 4 5 6 7 8 9 0 1 2 X A A A C C C D D D I A B C D E F G H I J K

Y
Z

1 2 3 1 2 3 1 2 3 1 4 1 4 4 1 1 1 1 2 1 1
1 5 8 1 1 1 1 1 2 2 3 6 7 8 9 1 1 2 3 4 1 6 7 1 9 1 1 2 2 4 0 5 0

A binary tree:

Given the binary tree above, the linked list according to algorithm GEN-COMP-NEXT is: a1 b1 d1 b2 e1 g1 e2 b3 a2 c2 f1 c3 a3. Therefore, the in-order traversal of this binary tree is d b g e a c f.

1. The algorithm GEN-COMP-NEXT requires O( n / p ) time using p processors on the EREW model 2. It also requires O( n / p ) time to mark the nodes to be deleted (selected).

3. The linked list packing algorithm requires O( n / p + log n ) time on EREW model.
The time complexity of the preceding algorithms is thus proved.

You might also like