Kulga Yeah, I don't know that you could algorithmically determine a hierarchy that's going to be accurate each time. At best you're really just guessing. If a site needs/wants to have all those badges displayed, they're probably not going to enjoy the trimming feature. If such a thing existed, I think it'd be better as a manual control on the admin (display badge per group) or user (choose which badges to show) side.
Maybe we need to see a mockup of different ways to display the badge not on the avatar, though. Different avatars are going to look different with the badges, and someone with an element to the top-right is going to get screwed either way. Or the badges are going to cover up an element so as to make the avatar look inappropriate for the community. I think the badges on avatars is a nice idea, but it might cause more problems than they're worth.