Moved graph functions to utils