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.

Categories

Horizontal hierarchical Layout swaps vertical node order

0 votes

If I sketch a horizontal tree and try to layout it automatically, using the hierarchical layout functionality with the option “from left to right” yEd automatically swaps/mirror’s the vertical order of the nodes. If I use a vertical ordering it doesn’t change the order. Did I miss an option to check to keep the vertical order or is this a bug/feature that I have to handle manually?

Does anybody have experience or a solution for this problem?

Cheers and thanks in advanced,
J

 

----------------

EDIT:

as requested a MWE graph (it's a real one with changed node names from my Dis.) and a PDF file with some screenshots about it (sry its in German but you will understand it ;-) ) [another sry 4 the bad quality but a bigger file size causes internal Server errors]

 

in Help by (170 points)
edited by

1 Answer

+1 vote
 
Best answer
If you need to keep the order of elements as is, you need to activate option "Use Drawing As Sketch" on tab "General" of the Hierarchical Layout settings.

Without "Use Drawing As Sketch" the algorithm is free to decide how to order elements for best results. In other words, if the order does not change it is by chance only.
by [yWorks] (161k points)
selected by
That is not 100% correct. Yes, it keeps the order but it does not produce a hierarchical layouted graph tree. It only produces two hierarchical levels and reorder the layers I a very strange way. But the worst thing is, that it draws the edges “around the nodes and from behind into the nodes”. Therefore, that is not an option to resolve the problem. In any way, I spent now several hours to reorder the graphs after applying the hierarchical layouts. That was the best way to handle it. Here some refinement in the ordering algorithms is needed.


Thanks for your reply any way. If the developers need a MWE for this problem, feel free to ask for one.

Thanks,
J

We would be very interested in an example where "Use Drawing As Sketch" does not keep the existing order of elements intact. So, yes, please upload a corresponding GraphML file here.

I have added an example

Thank you very much for the GraphML file and the PDF document.

The problem is that nodes of different layers overlap in x direction. (This is hard to see in your example because there are no borders around your nodes.) You need to pull your layers more apart such that nodes of different layers do not overlap at all.

E.g. run Hierarchical Layout with "Use Drawing  As Sketch" on this modified version of your example. (In this modified version, the nodes have black borders. These borders do not affect the layout result. They have been set only for the purpose of visualizing the node bounds thus making it easier to pull the nodes far enough apart.)

You’re right. Presorting the graph (especially in horizontal direction with vertical layer grouping) with enough whitespace does solve the problem! So the algorithm is in that case more position based than layout based. Good to know. Bad for people who needs a very automatic ordering.
Legal Disclosure | Privacy Policy
...