How to show one label for multiple links?

Here is the result I want to achieve. “A, B, C” have same relationship with “Root”, so I want to show only one label on the link. How should I implement this? Thanks!

What should happen when there needs to be more than one label?

For some nodes which have different relationship with “Root”, there will be only one link with a label on it.

What should happen when there needs to be more than one label?