change to use bfs instead of dfs to traverse the image