Refactored more code from `graph` to `network`