Depth First Search Cell Neighbour

Trying to implement depth first search currently, and I was wondering, what is the best way to check neighbor cells, to see if it has been visited/has a mesh already in the cell?

Many thanks!