Move read_topology outside main.