RESUMO
The effect of the detailed connectivity of a neural circuit on its function and the resulting behavior of the organism is a key question in many neural systems. Here, we study the circuit for nociception in C. elegans, which is composed of the same neurons in the two sexes that are wired differently. We show that the nociceptive sensory neurons respond similarly in the two sexes, yet the animals display sexually dimorphic behaviors to the same aversive stimuli. To uncover the role of the downstream network topology in shaping behavior, we learn and simulate network models that replicate the observed dimorphic behaviors and use them to predict simple network rewirings that would switch behavior between the sexes. We then show experimentally that these subtle synaptic rewirings indeed flip behavior. Interestingly, when presented with aversive cues, rewired males were compromised in finding mating partners, suggesting that network topologies that enable efficient avoidance of noxious cues have a reproductive "cost." Our results present a deconstruction of the design of a neural circuit that controls sexual behavior and how to reprogram it.