40 likes | 177 Views
r. HV tree drawing To draw a binary tree rooted at r inside a box that has dimensions w r X h r : Draw subtree under the children u and v of r recursively, in boxes of dimensions w u X h u and w v X h v respectively.
E N D
r HV tree drawing To draw a binary tree rooted at r inside a box that has dimensions wr X hr : Draw subtree under the children u and v of r recursively, in boxes of dimensions wu X hu and wvX hv respectively. Choose one of the four possible HV arrangements of the subtrees (there are two vertical arrangements and two horizontal arrangements). u v u Subtree under u Subtree under v v wv wu Subtree under u hu Subtree under v hv Question: how can we choose between the 4 arrangements? Two vertical arrangements wr= min{max(wu+ 1, wv), max(wu, wv + 1)) hr = hu+ hv+ 1 Two horizontal arrangements wr= wu+ wv+ 1 hr = min(max(hu + 1, hv), max(hu, hv + 1)) u Subtree under u Subtree under v v r r r r v Subtree under v u Subtree under u u Subtree under u v Subtree under v v Subtree under v u Subtree under u wr= wu+ wv+ 1 hr = max(hu + 1, hv) wr= wu+ wv+ 1 hr = max(hu, hv + 1) wr= max(wu+ 1, wv) hr = hu+ hv+ 1 wr= max(wu, wv + 1) hr = hu+ hv+ 1
h 0 0 2 5 11 1 v h 2 10 1 4 9 v v h 4 5 3 8 13 h h 6 7 8 9 10 11 14 3 7 Width=5, height=5 12 14 13 6 12 v 0 0 2 1 h v 2 5 11 v h v 4 5 3 10 Width=5, height=6 h v 6 7 8 9 10 11 1 4 8 13 12 14 13 3 7 14 6 9 12
Extending the lessons of HV-trees Tip-over trees • Same basic layout algorithm as for HV trees • Works for non-binary trees • At each internal node, need to choose between Horizontal and Vertical arrangements • HV tree 45o tree • HV trees can be rotated by 45o to give a more classical appearance. • Inclusion trees • Again, the same layout algorithm as for HV trees • At each internal node, we can to choose between Horizontal and Vertical arrangements • Works for non-binary trees, but becomes more difficult and less useful for trees where nodes have more than 3 or 4 children. • Perceptually not good if the number of levels is larger than 4 or 5. • References • Peter Eades, Tao Lin, Xuemin Lin: Two Tree Drawing Conventions. Int. J. Comput. Geometry Appl. 3(2): 133-153 (1993) • Peter Eades, Tao Lin, Xuemin Lin: Minimum Size h-v Drawings. Advanced Visual Interfaces 1992: 386-394 • Larry J. Stockmeyer: Optimal Orientations of Cells in Slicing Floorplan Designs Information and Control 57(2/3): 91-101 (1983)