Document Open Access Logo

Grid Recognition: Classical and Parameterized Computational Perspectives

Authors Siddharth Gupta, Guy Sa'ar, Meirav Zehavi

Thumbnail PDF


  • Filesize: 1.13 MB
  • 15 pages

Document Identifiers

Author Details

Siddharth Gupta
  • Ben Gurion University of the Negev, Beer Sheva, Israel
Guy Sa'ar
  • Ben Gurion University of the Negev, Beer Sheva, Israel
Meirav Zehavi
  • Ben Gurion University of the Negev, Beer Sheva, Israel

Cite AsGet BibTex

Siddharth Gupta, Guy Sa'ar, and Meirav Zehavi. Grid Recognition: Classical and Parameterized Computational Perspectives. In 32nd International Symposium on Algorithms and Computation (ISAAC 2021). Leibniz International Proceedings in Informatics (LIPIcs), Volume 212, pp. 37:1-37:15, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2021)


Grid graphs, and, more generally, k×r grid graphs, form one of the most basic classes of geometric graphs. Over the past few decades, a large body of works studied the (in)tractability of various computational problems on grid graphs, which often yield substantially faster algorithms than general graphs. Unfortunately, the recognition of a grid graph (given a graph G, decide whether it can be embedded into a grid graph) is particularly hard - it was shown to be NP-hard even on trees of pathwidth 3 already in 1987. Yet, in this paper, we provide several positive results in this regard in the framework of parameterized complexity (additionally, we present new and complementary hardness results). Specifically, our contribution is threefold. First, we show that the problem is fixed-parameter tractable (FPT) parameterized by k+mcc where mcc is the maximum size of a connected component of G. This also implies that the problem is FPT parameterized by td+k where td is the treedepth of G, as td ≤ mcc (to be compared with the hardness for pathwidth 2 where k = 3). (We note that when k and r are unrestricted, the problem is trivially FPT parameterized by td.) Further, we derive as a corollary that strip packing is FPT with respect to the height of the strip plus the maximum of the dimensions of the packed rectangles, which was previously only known to be in XP. Second, we present a new parameterization, denoted a_G, relating graph distance to geometric distance, which may be of independent interest. We show that the problem is para-NP-hard parameterized by a_G, but FPT parameterized by a_G on trees, as well as FPT parameterized by k+a_G. Third, we show that the recognition of k× r grid graphs is NP-hard on graphs of pathwidth 2 where k = 3. Moreover, when k and r are unrestricted, we show that the problem is NP-hard on trees of pathwidth 2, but trivially solvable in polynomial time on graphs of pathwidth 1.

Subject Classification

ACM Subject Classification
  • Theory of computation → Fixed parameter tractability
  • Mathematics of computing → Graph algorithms
  • Grid Recognition
  • Grid Graph
  • Parameterized Complexity


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Parameterized complexity in graph drawing (Dagstuhl Seminar 21062). URL:
  2. Akanksha Agrawal, Grzegorz Guspiel, Jayakrishnan Madathil, Saket Saurabh, and Meirav Zehavi. Connecting the Dots (with Minimum Crossings). In Gill Barequet and Yusu Wang, editors, Symposium on Computational Geometry (SoCG 2019), volume 129 of Leibniz International Proceedings in Informatics (LIPIcs), pages 7:1-7:17, Dagstuhl, Germany, 2019. Schloss Dagstuhl - Leibniz-Zentrum für Informatik. URL:
  3. Eric Allender, Tanmoy Chakraborty, David A Mix Barrington, Samir Datta, and Sambuddha Roy. Grid graph reachability problems. In 21st Annual IEEE Conference on Computational Complexity (CCC'06), pages 15-pp. IEEE, 2006. Google Scholar
  4. Esther M. Arkin, Michael A. Bender, Erik D. Demaine, Sándor P. Fekete, Joseph S. B. Mitchell, and Saurabh Sethia. Optimal covering tours with turn costs. SIAM J. Comput., 35(3):531-566, 2005. Google Scholar
  5. Pradeesha Ashok, Sudeshna Kolay, Syed Mohammad Meesum, and Saket Saurabh. Parameterized complexity of strip packing and minimum volume packing. Theor. Comput. Sci., 661:56-64, 2017. Google Scholar
  6. Michael J. Bannister, Sergio Cabello, and David Eppstein. Parameterized complexity of 1-planarity. J. Graph Algorithms Appl., 22(1):23-49, 2018. Google Scholar
  7. Moritz Beck and Sabine Storandt. Puzzling grid embeddings. In 2020 Proceedings of the Twenty-Second Workshop on Algorithm Engineering and Experiments (ALENEX), pages 94-105. SIAM, 2020. Google Scholar
  8. Arnold D Bergstra, Bert Brunekreef, and Alex Burdorf. The effect of industry-related air pollution on lung function and respiratory symptoms in school children. Environmental Health, 17(1):1-9, 2018. Google Scholar
  9. Sandeep N Bhatt and Stavros S Cosmadakis. The complexity of minimizing wire lengths in vlsi layouts. Information Processing Letters, 25(4):263-267, 1987. Google Scholar
  10. Sujoy Bhore, Robert Ganian, Fabrizio Montecchiani, and Martin Nöllenburg. Parameterized algorithms for book embedding problems. In Graph Drawing and Network Visualization - 27th International Symposium, GD 2019, Prague, Czech Republic, September 17-20, 2019, Proceedings, pages 365-378, 2019. Google Scholar
  11. Thomas Bläsius, Marcus Krug, Ignaz Rutter, and Dorothea Wagner. Orthogonal graph drawing with flexibility constraints. Algorithmica, 68(4):859-885, 2014. Google Scholar
  12. CDC. Social distancing. URL:, November 2020.
  13. Hubert Y. Chan. A parameterized algorithm for upward planarity testing. In European Symposium on Algorithms (ESA 2004), volume 3221 of Lecture Notes in Computer Science, pages 157-168. Springer, 2004. URL:
  14. Julia Chuzhoy, David H. K. Kim, and Rachit Nimavat. Almost polynomial hardness of node-disjoint paths in grids. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 1220-1233, 2018. Google Scholar
  15. Julia Chuzhoy, David H. K. Kim, and Rachit Nimavat. Improved approximation for node-disjoint paths in grids with sources on the boundary. In 45th International Colloquium on Automata, Languages, and Programming, ICALP 2018, July 9-13, 2018, Prague, Czech Republic, pages 38:1-38:14, 2018. Google Scholar
  16. Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. URL:
  17. Mark de Berg, Hans L. Bodlaender, Sándor Kisfaludi-Bak, Dániel Marx, and Tom C. van der Zanden. A framework for eth-tight algorithms and lower bounds in geometric intersection graphs. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 574-586, 2018. Google Scholar
  18. Emilio Di Giacomo, Giuseppe Liotta, and Fabrizio Montecchiani. Sketched representations and orthogonal planarity of bounded treewidth graphs. In Graph Drawing and Network Visualization (GD 2019), Lecture Notes in Computer Science. Springer, 2019. To appear. URL:
  19. Walter Didimo and Giuseppe Liotta. Computing orthogonal drawings in a variable embedding setting. In Algorithms and Computation (ISAAC 1998), volume 1533 of Lecture Notes in Computer Science, pages 79-88. Springer, 1998. Google Scholar
  20. Walter Didimo, Giuseppe Liotta, and Maurizio Patrignani. On the complexity of hv-rectilinear planarity testing. In International Symposium on Graph Drawing, pages 343-354. Springer, 2014. Google Scholar
  21. Walter Didimo, Giuseppe Liotta, and Maurizio Patrignani. HV-planarity: Algorithms and complexity. J. Comput. Syst. Sci., 99:72-90, 2019. Google Scholar
  22. Rodney G. Downey and Michael R. Fellows. Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, 2013. URL:
  23. Vida Dujmovic, Michael R. Fellows, Matthew Kitching, Giuseppe Liotta, Catherine McCartin, Naomi Nishimura, Prabhakar Ragde, Frances A. Rosamond, Sue Whitesides, and David R. Wood. On the parameterized complexity of layered graph drawing. Algorithmica, 52(2):267-292, 2008. URL:
  24. Fedor V Fomin, Daniel Lokshtanov, Saket Saurabh, and Meirav Zehavi. Kernelization: theory of parameterized preprocessing. Cambridge University Press, 2019. Google Scholar
  25. Joseph L Ganley. Computing optimal rectilinear steiner trees: A survey and experimental evaluation. Discrete Applied Mathematics, 90(1-3):161-171, 1999. Google Scholar
  26. Javier García-Pérez, Nerea Fernández de Larrea-Baz, Virginia Lope, Antonio J Molina, Cristina O'Callaghan-Gordo, María Henar Alonso, Marta María Rodríguez-Suárez, Benito Mirón-Pozo, Juan Alguacil, Inés Gómez-Acebo, et al. Residential proximity to industrial pollution sources and colorectal cancer risk: A multicase-control study (mcc-spain). Environment International, 144:106055, 2020. Google Scholar
  27. Michael R Garey and David S. Johnson. The rectilinear steiner tree problem is np-complete. SIAM Journal on Applied Mathematics, 32(4):826-834, 1977. Google Scholar
  28. Ashim Garg and Roberto Tamassia. On the computational complexity of upward and rectilinear planarity testing. SIAM Journal on Computing, 31(2):601-625, 2001. Google Scholar
  29. Angelo Gregori. Unit-length embedding of binary trees on a square grid. Information Processing Letters, 31(4):167-173, 1989. Google Scholar
  30. Martin Grohe. Computing crossing numbers in quadratic time. J. Comput. Syst. Sci., 68(2):285-302, 2004. URL:
  31. Magnús M. Halldórsson, Christian Knauer, Andreas Spillner, and Takeshi Tokuyama. Fixed-parameter tractability for non-crossing spanning trees. In Algorithms and Data Structures (WADS 2007), volume 4619 of Lecture Notes in Computer Science, pages 410-421. Springer, 2007. Google Scholar
  32. Dan Halperin, Oren Salzman, and Micha Sharir. Handbook of discrete and computational geometry. In Jacob E. Goodman, Joseph O'Rourke, and Csaba D. Tóth, editors, Handbook of Discrete and Computational Geometry, chapter 50, pages 1311-1342. CRC Press LLC, Boca Raton, FL, 2017. Google Scholar
  33. Cone Health. Social distancing faq: How it helps prevent covid-19 (coronavirus) and steps we can take to protect ourselves., May 2020.
  34. Patrick Healy and Karol Lynch. Two fixed-parameter tractable algorithms for testing upward planarity. Int. J. Found. Comput. Sci., 17(5):1095-1114, 2006. URL:
  35. Petr Hlinený and Marek Dernár. Crossing number is hard for kernelization. In Symposium on Computational Geometry (SoCG 2016), volume 51 of LIPIcs, pages 42:1-42:10. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016. Google Scholar
  36. Petr Hlinený and Abhisekh Sankaran. Exact crossing number parameterized by vertex cover. In Graph Drawing and Network Visualization (GD 2019), Lecture Notes in Computer Science. Springer, 2019. To appear. URL:
  37. Alon Itai, Christos H Papadimitriou, and Jayme Luiz Szwarcfiter. Hamilton paths in grid graphs. SIAM Journal on Computing, 11(4):676-686, 1982. Google Scholar
  38. Ken-ichi Kawarabayashi and Bruce A. Reed. Computing crossing number in linear time. In Symposium on Theory of Computing (STOC 2007), pages 382-390. ACM, 2007. Google Scholar
  39. Fabian Klute and Martin Nöllenburg. Minimizing crossings in constrained two-sided circular graph layouts. In Symposium on Computational Geometry (SoCG 2018), volume 99 of LIPIcs, pages 53:1-53:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018. Google Scholar
  40. Giordano Da Lozzo, David Eppstein, Michael T. Goodrich, and Siddharth Gupta. Subexponential-time and FPT algorithms for embedded flat clustered planarity. In Graph-Theoretic Concepts in Computer Science - 44th International Workshop, WG 2018, Cottbus, Germany, June 27-29, 2018, Proceedings, pages 111-124, 2018. URL:
  41. Giordano Da Lozzo, David Eppstein, Michael T. Goodrich, and Siddharth Gupta. C-planarity testing of embedded clustered graphs with bounded dual carving-width. In 14th International Symposium on Parameterized and Exact Computation, IPEC 2019, September 11-13, 2019, Munich, Germany, pages 9:1-9:17, 2019. URL:
  42. Lisa Lockerd Maragakis. Coronavirus, social and physical distancing and self-quarantine. URL:, July 2020.
  43. Md Saidur Rahman, Shin-ichi Nakano, and Takao Nishizeki. Rectangular grid drawings of plane graphs. Computational Geometry, 10(3):203-220, 1998. Google Scholar
  44. Md. Saidur Rahman, Takao Nishizeki, and Mahmuda Naznin. Orthogonal drawings of plane graphs without bends. J. Graph Algorithms Appl., 7(4):335-362, 2003. URL:
  45. Sadiq M Sait and Habib Youssef. VLSI physical design automation: theory and practice, volume 6. World Scientific Publishing Company, 1999. Google Scholar
  46. Nathan R Sturtevant. Benchmarks for grid-based pathfinding. IEEE Transactions on Computational Intelligence and AI in Games, 4(2):144-148, 2012. Google Scholar
  47. Paul Turán. A note of welcome. Journal of Graph Theory, 1(1):7-9, 1977. URL:
  48. Christopher Umans and William Lenhart. Hamiltonian cycles in solid grid graphs. In Proceedings 38th Annual Symposium on Foundations of Computer Science (FOCS), pages 496-505. IEEE, 1997. Google Scholar
  49. Martin Zachariasen. A catalog of hanan grid problems. Networks: An International Journal, 38(2):76-83, 2001. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail