I've been experimenting with Scala for some time, and have often encountered the advice to favor immutable data structures.
But when you have a data structure like e.g. a 3D scene graph, a large neural network, or anything with quite a few objects that need frequent updates (animating the objects in the scene, training the neural net, ...), this seems to be
horribly inefficient at runtime since you need to constantly recreate the whole object graph, and
difficult to program since when you have a reference to some objects that need to be updated, you can't just call setters on them but you need copy the object graph and replace the old objects with the updated ones.
How are such things dealt with in idiomatic Scala?