Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.


Alphabetically sort nodes within each group

+1 vote
I have a few dozends of nodes within groups that are within other groups. I want yEd to sort the nodes within each group in alphabetical order. The position of the groups is not to be changed.

How do I do that?

Thanks in advance,
in Help by (130 points)

1 Answer

0 votes
Unfortunately, yEd cannot do that. Moreover, I don't think such a feature can be easily implemented. For instance, what does sorting alphabetically mean in 2D? And how would you do that without changing the enclosing group? For any sorting scheme you propose, it should be easily possible to construct an example that would result in the enclosing group being changed.

(Keeping the position of groups is usually not enough, because size changes may easily lead to bad overlaps.)
by [yWorks] (160k points)
edited by
Well, there could for example be a function that sorts all selected items. In that case, all the selected items are in an array, either left-right or up-down. The function simply switches the nodes that are not in correct order (for example Bubble Sort algorithm). That way, the original form of the graph would be conserved.
You seem to be making several fairly strong assumptions on the input diagram. In 2D, it's usually "left-right AND up-down", not either or. ;-)  Moreover, nodes are usually NOT equally sized, which means that swapping nodes does not preserve "the form of the graph".
Legal Disclosure | Privacy Policy