Serko interview question

Some BFS/DFS graph question of matrices.