tree decomposition
play

Tree Decomposition Maren Kaluza HELMHOLTZ CENTRE FOR - PowerPoint PPT Presentation

Tree Decomposition Maren Kaluza HELMHOLTZ CENTRE FOR ENVIRONMENTAL November 2018 RESEARCH - UFZ UFZ Table Of Contents Introduction Parallelization Graphs, Trees rivernetwork (Hydrology) Tree Decomposition Goal Tree Data Structure Cut


  1. Tree Decomposition Goal 10 11 1 2 example: lowBound = 3 3 4 5 6 7 8 timeslots 6 11 9 10 process 1: 1 4 7 8 9 10 11 9 5 12 13 14 15 process 2: 2 5 process 3: 3 6 3 16 17 18 19 20 8 21 This is the shortest schedule, we can get with 22 23 24 25 this subtrees: The tree depth is 7, we can not 4 26 27 28 29 have a schedule shorter than the tree depth 2 30 31 32 33 UFZ 7 1 34

  2. Tree Decomposition Tree data structure: basic info 1 2 3 4 5 6 8 9 10 7 A classical tree data structure contains: 11 12 13 14 15 post : a pointer to the parent tree node 16 17 18 19 20 Nprae : the number of children prae : an array of pointers to the children 21 22 23 24 25 (note: each node is also a tree) 26 27 28 29 30 31 32 33 UFZ 34

  3. Tree Decomposition Tree data structure: specific for tree decomposition 1 2 3 4 5 6 8 9 10 7 Specific data for the tree decomposition siz : the size of the tree 11 12 13 14 15 sizUp : the size of the smallest subtree 16 17 18 19 20 larger than lowBound 21 22 23 24 25 ST : a pointer to metadata, if the tree node is the root node of a subtree 26 27 28 29 30 31 32 33 UFZ 34

  4. Tree Decomposition Tree data structure: derived type type ptrTreeNode type(treeNode), pointer :: tN end type ptrTreeNode type treeNode type(ptrTreeNode) :: post integer(i4) :: Nprae type(ptrTreeNode),dimension(:),allocatable :: prae integer(i4) :: siz integer(i4) :: sizUp type(subtreeNode), pointer :: ST end type treeNode UFZ

  5. Tree Decomposition Tree data structure: Set siz for each node 1 34 2 5 32 33 25 1 2 1 initialize siz with 1 for each tree node 1 23 3 2 1 run though tree in routing order 2 19 3 2 1 for each tree node: ◮ for all its children add the value of siz of 1 13 10 5 1 each child to own value of siz 2 4 3 2 1 3 2 1 UFZ 1

  6. Tree Decomposition Tree data structure: Set sizUp for each node 1 2 initialize sizeUp with 1 for each tree node 1 5 3 3 run though tree in routing order for each tree node: 3 1 1 1 ◮ for all its children check, if sizUp has 1 3 3 1 1 already been set for at least one child ◮ if so, set sizUp of current tree node to 1 3 3 1 1 the smallest of that values of its children ◮ if not, check if siz ≥ sizUp 1 3 3 3 2 ◮ if so, set sizUp = siz 1 3 3 1 ◮ else sizUp =1 (this has to be set, so the subroutine can update the tree after a 1 3 1 1 subtree gets cut of) UFZ 1

  7. Tree Decomposition Cut Of A Subtree cut of a subtree in sublinear time (depth of 1 2 tree) 3 4 5 6 Main idea, follow the branch with the smallest subtree ( find_branch ) 8 9 10 7 [Thomas H. Cormen, 2009, Harder, 2018] 11 12 13 14 15 start as root: 16 17 18 19 20 1. if one of the children of the current tree node has sizUp > 1 21 22 23 24 25 2. then switch to the child with the smallest 26 27 28 29 value for sizUp , go to step 1 30 31 32 33 3. else cut of subtree at that node UFZ 34

  8. Tree Decomposition Cut Of A Subtree 1 2 2 3 4 5 6 8 9 10 7 find_branch example: 11 12 13 14 15 1. tree node 2 has one child 6 16 17 18 19 20 2. 6 has sizUp > 1 therefore we move to 6 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  9. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 6 8 9 10 7 find_branch example: 11 12 13 14 15 1. tree node 6 has one child 5 16 17 18 19 20 2. 5 has sizUp > 1 therefore we move to 5 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  10. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 5 6 find_branch example: 8 9 10 7 1. tree node 5 has three childen 1, 4, 9 11 12 13 14 15 2. 1 has sizUp=1 (means not set), 4 has 16 17 18 19 20 sizUp = 5, 9 has sizUp = 3, therefore we move to 9 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  11. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 8 9 9 10 7 find_branch example: 11 12 13 14 15 1. tree node 9 has two childen 10, 12 2. 10 has sizUp=1 (means not set), 12 has 16 17 18 19 20 sizUp = 3, therefore we move to 12 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  12. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 8 9 10 7 find_branch example: 11 12 12 13 14 15 1. tree node 12 has two childen 13, 17 2. 13 and 17 both have sizUp = 3, therefore 16 17 18 19 20 we move to 13 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  13. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 8 9 10 7 find_branch example: 11 12 13 14 15 13 1. tree node 13 has one child 14 2. sizUp values of all children of 13 are 16 17 18 19 20 unset, therefore we cut of 13 21 22 23 24 25 26 27 28 29 30 31 32 33 UFZ 34

  14. Tree Decomposition Cut Of A Subtree 1 2 cut of a subtree 3 4 5 6 return a pointer to the subtree root (13) 8 9 10 7 update_sizes 11 12 13 13 14 15 initiate_subtreetreenode 16 17 18 19 20 in the parent node: ◮ switch the cut of child with the last child 21 22 23 24 25 in the prae array 26 27 28 29 ◮ reduce Nprae by one 30 31 32 33 update_tree UFZ 34

  15. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 8 9 10 7 update_sizes : for the cut of subtree (13) with size redSize 11 12 13 13 14 15 (3) 16 17 18 19 20 1. if not root, move to parent 21 22 23 24 25 2. reduce siz of curret node by redSiz , go to 1 26 27 28 29 30 31 32 33 UFZ 34

  16. Tree Decomposition Cut Of A Subtree 1 2 initiate_subtreetreenode : 3 4 5 6 associate and allocate pointer ST of tree 8 9 10 7 node 11 12 13 13 14 15 set size of subtreetreenode to current size 16 17 18 19 20 of tree node (after updating the tree structure, it is the correct size of the 21 22 23 24 25 subtree) 26 27 28 29 initialize other meta data with 0 and nullpointers 30 31 32 33 UFZ 34

  17. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 8 9 10 7 update_tree : 11 12 13 14 15 13 start at cut of tree node 16 17 18 19 20 1. update sizUp (as it was done before) 21 22 23 24 25 2. if not root, go to parent, go to step 1 26 27 28 29 30 31 32 33 UFZ 34

  18. Tree Decomposition Cut Of A Subtree 1 2 3 4 5 6 Special cases in the procesess of cutting of 8 9 10 7 subtrees: 11 12 13 14 15 13 root has no parent to be updated, so it has to be handled separately 16 17 18 19 20 if one of its children has sizeUp > 1, 21 22 23 24 25 follow branch as usual 26 27 28 29 else, cut of root 30 31 32 33 UFZ 34

  19. Tree Decomposition Tree Decomposition 10 11 1 2 3 4 5 6 7 8 decompose as long as the last cut of subtree is not 9 11 9 10 root 8 1 12 13 14 15 ◮ find and cut of subtree, return pointer to subtree 2 16 17 18 19 20 ◮ write pointer into an array 7 21 22 23 24 25 5 26 27 28 29 3 30 31 32 33 UFZ 6 4 34

  20. Tree Decomposition Tree Decomposition 10 11 1 2 3 4 5 6 7 8 decompose as long as the last cut of subtree is not 9 11 9 10 root 8 1 12 13 14 15 ◮ find and cut of subtree, return pointer to subtree 2 16 17 18 19 20 ◮ write pointer into an array 7 21 set metadata of subtree nodes 22 23 24 25 appropriately (set pointer to parents and 5 children) 26 27 28 29 3 30 31 32 33 UFZ 6 4 34

  21. Tree Decomposition The Subtree Data Structure 10 11 1 2 3 4 5 6 each subtreetree node has an associated 7 8 pointer to derived type subtreeNode with 9 11 9 10 classical tree data structure... 8 1 12 13 14 15 postST : a pointer to the parent tree node (points to tree node) 2 16 17 18 19 20 NpraeST : number of (subtreetree) 7 21 children 22 23 24 25 praeST : array of pointers to the 5 26 27 28 29 (subtreetree) children 3 30 31 32 33 UFZ 6 4 34

  22. Tree Decomposition The Subtree Data Structure 10 11 1 2 3 4 5 6 7 8 9 11 9 10 ...and specific information for scheduling 8 1 12 13 14 15 levelST : an array saving the distance to the root node and the distance to the 2 16 17 18 19 20 farthest leaf in the subtreetree structure 7 21 for scheduling purposes 22 23 24 25 5 26 27 28 29 3 30 31 32 33 UFZ 6 4 34

  23. Tree Decomposition Tree data structure: derived type type treeNode ... (s.o.) type(subtreeNode), pointer :: ST end type treeNode type subtreeNode type(ptrTreeNode) :: postST integer(i4) :: NpraeST type(ptrTreeNode),dimension(:),allocatable :: praeST integer(i4) :: sizST integer(i4), dimension(2) :: levelST end type subtreeNode UFZ

  24. Tree Decomposition Tree decomposition: scheduling 10 11 1 2 3 4 5 6 difference between two scheduling methods: 7 8 9 11 9 10 8 round robin 1 12 13 14 15 timeslots process 1: 1 4 7 10 2 16 17 18 19 20 process 2: 2 5 8 11 7 21 process 3: 3 6 9 22 23 24 25 5 26 27 28 29 3 30 31 32 33 UFZ 6 4 34

  25. Tree Decomposition Tree decomposition: scheduling 10 11 1 2 3 4 5 6 difference between two scheduling methods: 7 8 6 11 9 10 Hu’s algorithm[Hu, 1961, Cheng and Sin, 1990] 9 5 12 13 14 15 timeslots 3 16 17 18 19 20 process 1: 1 4 7 8 9 10 11 8 21 process 2: 2 5 22 23 24 25 process 3: 3 6 4 26 27 28 29 2 30 31 32 33 UFZ 7 1 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend