Download presentation

Presentation is loading. Please wait.

Published byJulia Donnelly Modified over 3 years ago

1
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 1 Sequential and Parallel Algorithms for Some Problems on Trees by Raymond Greenlaw Armstrong Atlantic State University Sequential and Parallel Algorithms for Some Problems on Trees by Raymond Greenlaw Armstrong Atlantic State University Joint work with: P. de la Torre Department of Computer Science University of New Hampshire M. Halldorsson Decode Genetics T. Przytycka Department of Biophysics John Hopkins University Medical School A. Schaffer National Institute of Health R. Petreschi Department of Computer Science University of Rome La Sapienza

2
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 2 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

3
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 3 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

4
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 4 Trees

5
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 5 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

6
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 6 Parallel Random Access Machine RAM Processors Global Memory Cells P0P0 P1P1 P2P2 C0C0 C1C1 C2C2

7
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 7 Preliminary Parallel Algorithms Brents Scheduling Principle Parallel Prefix Computation Euler Tour List Ranking Parallel Tree Contraction

8
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 8 Brents Scheduling Principle (Brent) If processor allocation is not a problem then a t(n) time parallel algorithm that requires w(n) computational operations can be simulated using w(n)/p(n) + t(n) time and p(n) processors.

9
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 9 Example of Brents

10
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 10 Parallel Prefix Computation (Ladner & Fisher) The Parallel Prefix Problem can be solved in O(log n) time using n/log n processors on an EREW-PRAM.

11
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 11 Example of Parallel Prefix

12
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 12 Euler Tour (Tarjan & Vishkin) An Euler tour of an n-node tree can be computed in O(log n) time using n/log n processors on an EREW-PRAM.

13
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 13 Example of Euler Tour

14
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 14 List Ranking (Anderson & Miller) Given a list with n nodes, the List Ranking Problem can be solved in O(log n) time using n/log n processors on an EREW-PRAM.

15
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 15 Example of List Ranking

16
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 16 Parallel Tree Contraction (He; Miller & Teng; Abrahamson, Dadoun, Kirkpatrick & Przytycka) Let T be an n-leaf regular binary expression tree. Then all of the algebraic expressions associated with the internal nodes (one per node) of T can be evaluated in O(log n) time using n/log n processors on an EREW-PRAM.

17
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 17 Example of Tree Contraction Scrunched tree

18
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 18 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

19
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 19 Node Ranking A node ranking is a labeling of the nodes of a tree with natural numbers such that if nodes u and v have the same label then there exists another node with a greater label on the path between them. An optimal node ranking is a node ranking in which the largest label assigned to any node is as small as possible among all node rankings. The node ranking problem is to compute an optimal node ranking.

20
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 20 Node Ranking Example

21
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 21 Node Ranking: Sequential Results Node Ranking Problem O(n log n) time (Iyer, Ratliff & Vijayan) O(n) time (Schaffer)

22
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 22 Example of Sequential Node Ranking Algorithm Critical list at * is {3,4} Label 3 at ** covers values 1 and 2

23
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 23 Example of Sequential Node Ranking Algorithm Critical list at * is {3,4} Label 3 at ** covers values 1 and 2

24
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 24 Node Ranking: Parallel Results Approximate Optimal Tree Ranking O(log 2 n) time, n processors EREW-PRAM (Liang, Dhall & Lakshmivarahan) Optimal Tree Ranking O(log n) time, n 2 /log n procs CREW-PRAM (de la Torre & Greenlaw) (Przytycka) Super Critical Tree Numbering O(log n) time, n 2 /log n procs CREW-PRAM (de la Torre, Greenlaw & Przytycka)

25
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 25 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

26
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 26 Edge Ranking An edge ranking is a labeling of the edges of a tree with natural numbers such that if edges u and v have the same label then there exists another edge with a greater label on the path between them. An optimal edge ranking is an edge ranking in which the largest label assigned to any edge is as small as possible among all edge rankings. The edge ranking problem is to compute an optimal edge ranking.

27
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 27 Edge Ranking Example

28
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 28 Edge Ranking: Sequential Results Approximate Edge Ranking O(n log n) time (Iyer, Ratliff & Vijayan) Optimal Edge Ranking O(n 3 log n) time (de la Torre, Greenlaw & Schaffer) O(n 2 log n) time (Zhou, Kashem & Nishizeki) O(n log n) time, O(n) time (Lam & Ling)

29
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 29 From Local to Global Optimality

30
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 30 Greedy Cover Labeling L c > L c-1 > … > L 1 is a greedy cover labeling if and only if cover(L i, crit(v j )) lex cover(L i, crit(v i )) for all i and for all j < i.

31
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 31 Example of Edge Ranking Algorithm

32
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 32 Example of Edge Ranking Algorithm

33
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 33 Example of Edge Ranking Algorithm

34
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 34 Edge Ranking: Parallel Results Approximate Edge Ranking O(log 2 n) time, n 2 /log n processors CREW-PRAM (de la Torre, Greenlaw & Schaffer) Optimal Edge Ranking of Constant Degree Trees NC (de la Torre, Greenlaw & Schaffer)

35
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 35 Motivation for Studying Rankings

36
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 36 Motivation for Studying Rankings

37
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 37 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

38
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 38 Definition of Prüfer Code A Prüfer code of a labeled free tree with n nodes is a sequence of length n – 2 constructed by the following sequential process: for i ranging from 1 to n – 2 do insert the label of the neighbor of the smallest remaining leaf into the i-th position of the sequence; delete the leaf;

39
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 39 Example of a Prüfer Code (9,6,5,6,1,6,1,1)

40
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 40 Related Work Prüfer code to tree EREW-PRAM O(log n) time, n processors proposed as an open problem the reverse direction (Wang, Chen & Liu) Tree to Prüfer code EREW-PRAM O(log n) time, n processors (Chen & Wang, Greenlaw & Petreschi)

41
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 41 Related Work Continued Chain to Prüfer code EREW-PRAM O(log n) time, n/log n (Greenlaw & Petreschi) Used Prüfer codes for random tree generation (Kumar, Deo & Kumar)

42
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 42 Can Sequential Algorithm Prüfer Code Be Parallelized? Initial intuition suggests no. What type of running time do we want? How do we proceed?

43
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 43 Parallel Algorithm Prüfer Chain The Prüfer code of this chain is (2,8,3,7,5,6)

44
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 44 Parallel Algorithm Prüfer Chain Step 1: /* Compute the position of each node in the chain. */ 1.Use parallel list ranking to construct the array Position such that Position[i] = v, 1 i n, where node v has a ranking of i in T 43756821 12345678

45
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 45 Parallel Algorithm Prüfer Chain Step 2: /* Compute the maximum nodes encountered thus far in left-to-right and right-to-left traversals over the chain. */ 2. Use parallel prefix computation to construct the arrays LRMax and RLMax LRMax[i] = max{Position[j] | 1 j i} RLMax[i] = max{Position[j] | n – i + 1 j n} 0447778889 0128888889

46
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 46 Parallel Algorithm Prüfer Chain Step 3: /* Compute when a node becomes a maximum (if it does) for both left- to-right and right-to-left traversals. */ 3. For 1 i n in parallel do if LRMax[i-1] LRMax[i] then LRStart[LRMax[i]] = i; if RLMax[i-1] RLMax[i] then RLStart[RLMax[i]] = i; 00010036 12000003

47
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 47 Parallel Algorithm Prüfer Chain Step 4: /* Compute when a node is no longer a maximum (if it was) for both left-to-right and right-to-left traversals. */ 4. For 1 i n in parallel do if LRMax[i] LRMax[i+1] then LREnd[LRMax[i]] = i; if RLMax[i] RLMax[i+1] then RLEnd[RLMax[i]] = i; 00020058 12000008

48
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 48 Parallel Algorithm Prüfer Chain Step 5: /* Compute how many positions a node was maximum for. */ 5. For 1 i n in parallel do if LRStart[i] 0 then LRSpan[i] = LREnd[i] - LRStart[i] + 1; if RLStart[i] 0 then RLSpan[i] = RLEnd[i] - RLStart[i] + 1; 000020033 011000006

49
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 49 Parallel Algorithm Prüfer Chain Step 6: /* Compute how many nodes a given node is greater than from the left. Similiarly for the right. */ 6.Use parallel prefix to construct the array LeftClear and RightClear, where 1 i n LeftClear[i] = LRSpan[0] + … + LRSpan[i-1]; RightClear[i] = RLSpan[0] + … + RLSpan[i-1]; 00002225 01222222

50
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 50 Parallel Algorithm Prüfer Chain Step 7: /* Removal[i] denotes when the node in Position[i] is removed. */ 7. For 1 i n in parallel do if RLMax[n-i] > LRMax[i-1] then k = LRMax[i]; Removal[i] = i + RightClear[k]; else k = RLMax[n-i+1]; Removal[i] = (n – i) + 1 + LeftClear[k]; 34567821

51
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 51 Theorem on Chains (Greenlaw & Petreschi) The Prüfer code of an n-node labeled chain can be computed in O(log n) time using n/log n processors on an EREW-PRAM.

52
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 52 Parallel Algorithm Prüfer Tree

53
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 53 Parallel Algorithm Prüfer Tree

54
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 54 Theorem on Trees (Greenlaw, Halldorsson & Petreschi) The Prüfer code of an n-node labeled free tree can be computed in O(log n) time using n/log n processors on an EREW-PRAM. In the other direction we show Given the Prüfer code of an n-node labeled chain we can output the corresponding chain in O(log n) time using n/log n processors on an EREW-PRAM.

55
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 55 Prüfer Code Summary Tree to P-codeP-code to Tree sequentialO(n) folkloreO(n) parallelO(log n) time, n processors EREW-PRAM O(log n) time, n processors EREW-PRAM For a chain O(log n) time, n/log n processors EREW-PRAM For a chain O(log n) time, n/log n processors EREW-PRAM For a tree O(log n) time, n/log n processors EREW-PRAM

56
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 56 Outline Introduction Parallel Preliminaries Node Ranking Edge Ranking Prüfer Codes Open Problems

57
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 57 Open Problems Can an optimal parallel algorithm be developed for building a tree given its Prüfer code? Can the Element Distinctness Problem be solved on a CREW-PRAM in O(log n) time using n/log n processors? Is the edge ranking problem on trees P-complete? Can all n-node trees be labeled with the values 1 through n such that neighors receive pairwise relatively prime labels?

58
Sequential and Parallel Algorithms for Some Problems on Trees Raymond Greenlaw 58 References See www.cs.armstrong.edu/greenlaw

Similar presentations

Presentation is loading. Please wait....

OK

Before Between After.

Before Between After.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on indian army weapons Ppt on hotel industry in india Free ppt on moving coil galvanometer Ppt on acids bases and salts for class 7 Ppt on fire extinguisher types chart Open ppt on ipad 2 Ppt on population census 2011 data Ppt on regional trade agreements definition A ppt on loch ness monster evidence Ppt on nursing management of spinal cord injury