TITLE: Maximum layer size in BFS tree for partial grid
QUESTION [5 upvotes]: Given positive integers $n$ and $m$. We choose any partial grid $G$ that is a subgraph of $n \times m$ grid. We choose some vertex $v$ of $G$ and run breadth first search (BFS) algorithm from this vertex. Layer of BFS tree is a set of vertices with the same distance (in edges) to $v$. The question is the following:

What is the maximum size of layer of BFS tree over all choices of $G$ and $v$ for given $n$ and $m$?

Particularly, is it true that size of each layer is $O(n + m)$? Or can it be $\Omega(nm)$?
Background of this question is the following. I want to challenge student's solution for a problem that requires BFS on partial grid. The problem in his implementation is that he uses array instead of queue and deletes the first element shifting all others. Therefore time complexity of his implementation is $\Omega(\ell_0^2 + \ell_1^2 + \cdots + \ell_d^2)$, where $\ell_i$ is number of vertices with distance $i$ to vertex $v$ and $d$ is the maximum distance to $v$. This is obviously quadratically bad time for general case, however it would be acceptable by judge system subject to existing constraints on $n$ and $m$ (up to $300$) if there is no test case with layer size of $\omega(n + m)$.

REPLY [5 votes]: Here is a different example that has a leaf within each $2\times 2$ area:

I hope this helps $\ddot\smile$