It doesn’t matter how careful you are not to add edges leading to walls in an undirected graph if you then merrily add edges from them.