Rifs-EM, refactoring graphs