Coevolution of agents and networks: Opinion spreading and community disconnection