Minima and Critical Points of the Bethe Free Energy Are Invariant Under Deformation Retractions of Factor Graphs