Added HierarchicalMultilabelModel class

This inner while loop wouldn't be necessary if the nodes are already sorted in pre-order or if we stored iteration order somewhere (because then it would be easy to start with the leaves and to guarantee that parents are always called after their parents ;)).

No need to change that.  Just saying.