Sorting of nodes by its level Name

Its possible to sort the nodes based on their node level names…(After applying sorting: go.TreeLayout.SortingAscending this code)

I am getting the below model and required to sort the nodes further.

Current model:

Need to sort the nodes by their level .
For example green node belongs to one level and orange one belongs to one level.but…its mixed in position after sorting(see above pic)

Required model:

Give some suggestions ,
Thank you

The sorting in TreeLayout only applies to the immediate children of a vertex. Are you asking about how to order the nodes in a layer when the nodes do not share the same parent but only share a grandparent or a greatgrandparent?

If so, I suppose you could override TreeLayout.commitNodes to call the super method and then rearrange the nodes the way that you want. But that might cause problems if the nodes are of different sizes.