Topological pattern selection in recurrent networks