According to some slides I found on google, the treewidth of any $k \times k$ square grid graph $G$ is $tw(G) = k$. I just started researching about treewidth and tree decomposition, and for the most part it makes sense. However, I am particularly interested in the $k \times k$ square grid graph case, but have been struggling on how it is possible to make a tree decomposition of such a graph with that low of a width.

One of the problems I run into when trying to draw out decomposition trees of small square grids with groups of at most $k+1$ (to ensure a decomposition tree where the width is $k$) is that since the graph is "cyclic", one of the corner nodes shows up in two opposite ends of the tree, but not in any nodes on the path between the two. This clearly violates the coherence property of decomposition trees, which according to Wikipedia (which gives a more precise definition than most) is:

If $X_{i}$, $X_{j}$, and $X_{k}$ are nodes (in the decomposition tree), and $X_{k}$ is on the path from $X_{i}$ to $X_{j}$, then $X_{i}\cap X_{j}\subseteq X_{k}$.

For the case of the $3 \times 3$ graph, the only valid (or at least what I believe to be valid) decomposition tree I can think of contains 2 nodes: $\{\{1, 2, 3, 4, 6, 7, 8, 9\}, \{2, 4, 5, 6, 8\}\}$ where the nodes are labeled by row starting from the top left corner:




I did this by taking the perimeter vertices for the first tree node, and the inner vertex ($5$) along with its adjacent vertices to ensure all edges and vertices are included.

Ultimately, my question is, how can the treewidth of a square $k \times k$ square grid graph actually be equal to $k$? And if this is correct, could you present/explain a simple example of a decomposition tree that demonstrates this property?

  • $\begingroup$ Maybe they meant that the treewidth is $\Theta(k)$. This seems to be correct. $\endgroup$ Commented Sep 1, 2016 at 6:20
  • $\begingroup$ @YuvalFilmus No, the treewidth really is $k$. $\endgroup$ Commented Sep 1, 2016 at 8:07
  • $\begingroup$ I've seen that it has to do with the bramble order being $k \plus 1$, but I'm looking for a concrete example of a tree decomposition that shows how this is possible. $\endgroup$ Commented Sep 1, 2016 at 8:09

1 Answer 1


The treewidth (and pathwidth) of the $k\times k$ grid is exactly $k$. (And, more generally, the treewidth and pathwidth of the $k\times\ell$ grid is exactly $\min\,\{k,\ell\}$). For the example grid


the bags of the tree decomposition are $\{1,2,3,4\}, \{2,3,4,5\}, \{3,4,5,6\}, ..., \{6,7,8,9\}$.

Note that the bag $\{1,2,3,4\}$ already contains all edges adjacent to $1$, so we don't need to include that vertex ever again. Similarly, $\{2,3,4,5\}$ contains all of the edges adjacent to $2$ that weren't already in the first bag.

  • $\begingroup$ Wow, so... simple... I must have really been overthinking this one, looking for different kinds of patterns based on the geometry of the square. $\endgroup$ Commented Sep 1, 2016 at 8:14
  • $\begingroup$ why the treewidth of $k *l$ grids is exactly $min \left\{k,l\right\}$? I can see how to get a tree decomposition with width $min \left\{k,l\right\}+1$ from your answer, but how to argue there's no tree decomposition with less width? $\endgroup$
    – Jxb
    Commented Apr 21, 2023 at 8:13
  • $\begingroup$ @Jxb. The k times l contains the min{k,l} by min{k,l} grid as a subgraph $\endgroup$
    – a3nm
    Commented Nov 21, 2023 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.