refactoring graph, add id