You probably don't need a hierarchy, but instead a collection of tags about each icon. Then you can select only the badges that have all the requested tags.
The real problem is the parent / child problem. Do baby icons have parents, or do parents have children? If you say that parents have children, you double the children in the hierarchy because each of the children must be under each of the parents. The same is true if you look at it the other way around. It is often better (especially for what you offer) to simply assign attributes to each βpersonβ for whom there are their children and who their parents are. You can then let the user decide what the tree looks like.