We investigate the complexity of producing aesthetically pleasing drawings of binary trees, drawings that are as narrow as possible. The notion of what is aesthetically pleasing is embodied in several constraints on the placement of nodes, relative to other nodes. Among the results we give are: (1) There is no obvious “principle of optimality” that can be applied, since globally narrow, aesthetic placements of trees may require wider than necessary subtrees. (2) A previously suggested heuristic can produce drawings on n-node trees that are Θ(n) times as wide as necessary. (3) The problem can be reduced in polynomial time to linear programming; hence, if the coordinates assigned to the nodes are continuous variables, then the problem can be solved in polynomial time. (4) If the placement is restricted to the integral lattice then the problem is NP-hard, as is its approximation to within a factor of about 4 per cent.
Unable to display preview. Download preview PDF.
- 1.Borosh, I., Treybig, L.B.: Bounds on Positive Integral Solutions of Linear Diophantine Equations. Proc. Amer. Math. Soc. 55, 299–304 (1976)Google Scholar
- 2.Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Co., San Francisco, 1979Google Scholar
- 3.Khachian, L.G.: A Polynomial Algorithm for Linear Programming. Doklady Akad. Nauk SSSR 244, 191–194 (1979)Google Scholar
- 4.Knott, G.D.: A Numbering System for Binary Trees. Comm. ACM 20, 113–115 (1977)Google Scholar
- 5.Knuth, D.E.: The Art of Computer Programming, Vol.1: Fundamental Algorithms. Addison-Wesley Publishing Co., Reading, MA, 1968Google Scholar
- 6.Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial Algorithms: Theory and Practice. Prentice-Hall: Englewood Cliffs, New Jersey, 1977Google Scholar
- 7.Reingold, E.M., Tilford, J.S.: Tidier Drawings of Trees. IEEE Trans. Software Engineerg. 7 223–228 (1981)Google Scholar
- 8.Sahni, S., Gonzalez, T.: P-complete Approximation Problems. J. ACM 23, 555–565 (1976)Google Scholar
- 9.Vaucher, J.G.: Pretty-Printing of Trees. Software-Practice and Experience 10, 553–561 (1980)Google Scholar
- 10.Wetherell, C., Shannon, A.: Tidy Drawings of Trees. IEEE Trans. Software Engineerg. 5, 514–520 (1979)Google Scholar