The complexity of drawing trees nicely

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.

This is a preview of subscription content, log in to check access.

References

  1. 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. 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, 1979

    Google Scholar 

  3. 3.

    Khachian, L.G.: A Polynomial Algorithm for Linear Programming. Doklady Akad. Nauk SSSR 244, 191–194 (1979)

    Google Scholar 

  4. 4.

    Knott, G.D.: A Numbering System for Binary Trees. Comm. ACM 20, 113–115 (1977)

    Google Scholar 

  5. 5.

    Knuth, D.E.: The Art of Computer Programming, Vol.1: Fundamental Algorithms. Addison-Wesley Publishing Co., Reading, MA, 1968

    Google Scholar 

  6. 6.

    Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial Algorithms: Theory and Practice. Prentice-Hall: Englewood Cliffs, New Jersey, 1977

    Google Scholar 

  7. 7.

    Reingold, E.M., Tilford, J.S.: Tidier Drawings of Trees. IEEE Trans. Software Engineerg. 7 223–228 (1981)

    Google Scholar 

  8. 8.

    Sahni, S., Gonzalez, T.: P-complete Approximation Problems. J. ACM 23, 555–565 (1976)

    Google Scholar 

  9. 9.

    Vaucher, J.G.: Pretty-Printing of Trees. Software-Practice and Experience 10, 553–561 (1980)

    Google Scholar 

  10. 10.

    Wetherell, C., Shannon, A.: Tidy Drawings of Trees. IEEE Trans. Software Engineerg. 5, 514–520 (1979)

    Google Scholar 

Download references

Author information

Affiliations

Authors

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

Reprints 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

Download citation

Keywords

  • Information System
  • Operating System
  • Continuous Variable
  • Data Structure
  • Communication Network