Refactor network graph