Graphs refactoring