graphs – Is the complexity of the width of the first search surface on a grid different?

Does the O space complexity (number_rows + number_cols) for the width search first Grid. This is an attempt to show my reasoning:

For example, the filling question is described here:

https://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/

The fill algorithm using the first width search (queue) has a space complexity: O (number_rows + number_cols).

Why? Suppose you start from the upper left corner (or the coordinate (0,0)). By going to the right, we will have at most O (number_cols) in the queue. When we reach the end of the column, we can then begin to descend from the (0, 0) coordinate by giving O (number_cows + number_cols) in the queue.

Then, is it true that most of the questions for which we use a deep search in width on a grid lead to a spatial complexity of O (number_rows + number_cols). For example:

  1. Fill in the question above,
  2. Maze where you have to find the shortest
    way from beginning to end,
  3. Search the number of islands (reference below)

But for 3) to find the number of islets, it seems that some people say that the time complexity is O (number_rows * number_cols) from https://stackoverflow.com/questions/50901203/dfs-and-bfs-time -and-space-complexities-of-number-of-islands-on-leetetcode

On the other hand, I would assume that the spatial complexity of dfs on a grid is O (number_rows * number_cols)

The questions are as follows on the basis of the above:

  1. Is the spatial complexity of width first a search on a grid: O (number_rows + number_cols)?
  2. Is the spatial complexity of the depth first searched on a grid: O (number_rows * number_cols)?

Other references:

https://stackoverflow.com/questions/21054959/time-and-space-complexity-for-breadth-first-search

https://stackoverflow.com/questions/4261112/time-and-space-complexities-of-breadth-first-search