RIFS-EM, Refactoring graphs