How axon and dendrite branching are guided by time, energy, and spatial constraints