Placing Text Boxes on Graphs

A Fast Approximation Algorithm for Maximizing Overlap of a Square and a Simple Polygon
  • Sjoerd van Hagen
  • Marc van Kreveld
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5417)


In this paper we consider the problem of placing a unit square on a face of a drawn graph bounded by n vertices such that the area of overlap is maximized. Exact algorithms are known that solve this problem in O(n2) time. We present an approximation algorithm that—for any given ε> 0—places a (1 + ε)-square on the face such that the area of overlap is at least the area of overlap of a unit square in an optimal placement. The algorithm runs in \(O(\frac{1}{\epsilon}\, n\log^2 n)\) time. Extensions of the algorithm solve the problem for unit discs, using \(O(\frac{\log (1/\epsilon)}{\epsilon\sqrt{\epsilon}}\, n\log ^2n)\) time, and for bounded aspect ratio rectangles of unit area, using \(O(\frac{1}{\epsilon^2}\, n\log^2 n)\) time.


  1. 1.
    Baker, B., Fortune, S., Mahaney, S.: Polygon containment under translation. J. Algorithms 7(4), 532–548 (1986)CrossRefMATHMathSciNetGoogle Scholar
  2. 2.
    de Berg, M., Cheong, O., Devillers, O., van Kreveld, M., Teillaud, M.: Computing the maximum overlap of two convex polygons under translations. Theory Comput. Syst. 31(5), 613–628 (1998)CrossRefMATHMathSciNetGoogle Scholar
  3. 3.
    de Berg, M., Cheong, O., van Kreveld, M., Overmars, M.: Computational Geometry – Algorithms and Applications, 3rd edn. Springer, Berlin (2008)MATHGoogle Scholar
  4. 4.
    Chazelle, B., Edelsbrunner, H., Guibas, L., Sharir, M.: Algorithms for bichromatic line-segment problems and polyhedral terrains. Algorithmica 11(2), 116–132 (1994)CrossRefMATHMathSciNetGoogle Scholar
  5. 5.
    Daniels, K., Milenkovic, V., Roth, D.: Finding the largest area axis-parallel rectangle in a polygon. Comput. Geom. Theory Appl. 7, 125–148 (1997)CrossRefMATHMathSciNetGoogle Scholar
  6. 6.
    Dogrusöz, U., Feng, Q.W., Madden, B., Doorley, M., Frick, A.: Graph visualization toolkits. IEEE Computer Graphics and Appl. 22(1), 30–37 (2002)CrossRefGoogle Scholar
  7. 7.
    Dogrusöz, U., Kakoulis, K., Madden, B., Tollis, I.: On labeling in graph visualization. Inf. Sci. 177(12), 2459–2472 (2007)CrossRefGoogle Scholar
  8. 8.
    Efrat, A., Sharir, M.: On the complexity of the union of fat convex objects in the plane. Discr. & Comput. Geometry 23(2), 171–189 (2000)CrossRefMATHMathSciNetGoogle Scholar
  9. 9.
    Gudmundsson, J., van Kreveld, M., Speckmann, B.: Efficient detection of patterns in 2D trajectories of moving points. GeoInformatica 11, 195–215 (2007)CrossRefGoogle Scholar
  10. 10.
    Har-Peled, S., Mazumdar, S.: Fast algorithms for computing the smallest k-enclosing circle. Algorithmica 41(3), 147–157 (2005)CrossRefMATHMathSciNetGoogle Scholar
  11. 11.
    Hoffman, K., Mehlhorn, K., Rosenstiehl, P., Tarjan, R.: Sorting jordan sequences in linear time using level-linked search trees. Information and Control 68(1–3), 170–184 (1986)CrossRefMathSciNetGoogle Scholar
  12. 12.
    Iturriaga, C., Lubiw, A.: Elastic labels: the two-axis case. In: DiBattista, G. (ed.) GD 1997. LNCS, vol. 1353, pp. 181–192. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  13. 13.
    Iturriaga, C., Lubiw, A.: Elastic labels around the perimeter of a map. J. Algorithms 47(1), 14–39 (2003)CrossRefMATHMathSciNetGoogle Scholar
  14. 14.
    Kakoulis, K., Tollis, I.: A unified approach to automatic label placement. Int. J. Comput. Geometry Appl. 13(1), 23–60 (2003)CrossRefMATHMathSciNetGoogle Scholar
  15. 15.
    van Kreveld, M.: On fat partitioning, fat covering, and the union size of polygons. Comput. Geom. Theory Appl. 9, 197–210 (1998)CrossRefMATHGoogle Scholar
  16. 16.
    van Kreveld, M., Schramm, E., Wolff, A.: Algorithms for the placement of diagrams on maps. In: GIS 2004: Proc. 12th annu. ACM Int. Symp. on Advances in Geographic Information Systems, pp. 222–231. ACM Press, New York (2004)Google Scholar
  17. 17.
    Mount, D., Silverman, R., Wu, A.: On the area of overlap of translated polygons. Computer Vision and Image Understanding 64(1), 53–61 (1996)CrossRefGoogle Scholar
  18. 18.
    Paterson, M., Yao, F.: Binary partitions with applications to hidden surface removal and solid modelling. In: Proc. 5th annual ACM Symp. on Computational Geometry, pp. 23–32 (1989)Google Scholar
  19. 19.
    Ryall, K., Marks, J., Shieber, S.: An interactive system for drawing graphs. In: North, S.C. (ed.) GD 1996. LNCS, vol. 1190, pp. 387–394. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  20. 20.
    van der Stappen, A.: Motion Planning amidst Fat Obstacles. Ph.D. thesis, Department of Computer Science, Utrecht University (1994)Google Scholar
  21. 21.
    Veltkamp, R., Hagedoorn, M.: State of the art in shape matching. In: Lew, M. (ed.) Principles of Visual Information Retrieval, pp. 87–119. Springer, Heidelberg (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Sjoerd van Hagen
    • 1
  • Marc van Kreveld
    • 1
  1. 1.Department of Information and Computing SciencesUtrecht UniversityThe Netherlands

Personalised recommendations