Add writing edge list to file, refactor graph IO