Filling crosswords is very hard - Archive ouverte HAL Accéder directement au contenu
Article Dans Une Revue Theoretical Computer Science Année : 2024

Filling crosswords is very hard

Résumé

We revisit a classical crossword filling puzzle which already appeared in Garey& Jonhson's book. We are given a grid with n vertical and horizontal slots and a dictionary with m words. We are asked to place words from the dictionary in the slots so that shared cells are consistent. We attempt to pinpoint the source of intractability of this problem by carefully taking into account the structure of the grid graph, which contains a vertex for each slot and an edge if two slots intersect. Our main approach is to consider the case where this graph has a tree-like structure. Unfortunately, if we impose the common rule that words cannot be reused, we discover that the problem remains NP-hard under very severe structural restrictions, namely, if the grid graph is a union of stars and the alphabet has size 2, or the grid graph is a matching (so the crossword is a collection of disjoint crosses) and the alphabet has size 3. The problem does become slightly more tractable if word reuse is allowed, as we obtain an m tw algorithm in this case, where tw is the treewidth of the grid graph. However, even in this case, we show that our algorithm cannot be improved to obtain fixed-parameter tractability. More strongly, we show that under the ETH the problem cannot be solved in time m o(k) , where k is the number of horizontal slots of the instance (which trivially bounds tw). Motivated by these mostly negative results, we also consider the much more restricted case where the problem is parameterized by the number of slots n. Here, we show that the problem does become FPT (if the alphabet has constant size), but the parameter dependence is exponential in n 2. We show that this dependence is also justified: the existence of an algorithm with running time 2 o(n 2) , even for binary alphabet, would contradict the randomized ETH. After that, we consider an optimization version of the problem, where we seek to place as many words on the grid as possible. Here it is easy to obtain a A preliminary version of this work appears in the proceedings of ISAACS 2021 [8].
Fichier principal
Vignette du fichier
Puzzle-15.pdf (443.98 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-04487531 , version 1 (03-03-2024)

Identifiants

Citer

Laurent Gourvès, Ararat Harutyunyan, Michael Lampis, Nikolaos Melissinos. Filling crosswords is very hard. Theoretical Computer Science, 2024, 982, pp.114275. ⟨10.1016/J.TCS.2023.114275⟩. ⟨hal-04487531⟩
15 Consultations
2 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More