Returns the number of children of parent.
Throws an exception if parent is not a StateNode or if parent is not contained in this model.