graphs util refactored