Summary
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.
Similar content being viewed by others
References
Borosh, I., Treybig, L.B.: Bounds on Positive Integral Solutions of Linear Diophantine Equations. Proc. Amer. Math. Soc. 55, 299–304 (1976)
Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Co., San Francisco, 1979
Khachian, L.G.: A Polynomial Algorithm for Linear Programming. Doklady Akad. Nauk SSSR 244, 191–194 (1979)
Knott, G.D.: A Numbering System for Binary Trees. Comm. ACM 20, 113–115 (1977)
Knuth, D.E.: The Art of Computer Programming, Vol.1: Fundamental Algorithms. Addison-Wesley Publishing Co., Reading, MA, 1968
Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial Algorithms: Theory and Practice. Prentice-Hall: Englewood Cliffs, New Jersey, 1977
Reingold, E.M., Tilford, J.S.: Tidier Drawings of Trees. IEEE Trans. Software Engineerg. 7 223–228 (1981)
Sahni, S., Gonzalez, T.: P-complete Approximation Problems. J. ACM 23, 555–565 (1976)
Vaucher, J.G.: Pretty-Printing of Trees. Software-Practice and Experience 10, 553–561 (1980)
Wetherell, C., Shannon, A.: Tidy Drawings of Trees. IEEE Trans. Software Engineerg. 5, 514–520 (1979)
Author information
Authors and Affiliations
Additional information
This research was supported in part by the National Science Foundation, grant numbers NSF MCS 77-22830, NSF MCS 79-04897, and NSF MCS 81-17364
Rights and permissions
About this article
Cite this article
Supowit, K.J., Reingold, E.M. The complexity of drawing trees nicely. Acta Informatica 18, 377–392 (1983). https://doi.org/10.1007/BF00289576
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00289576