elk
elk copied to clipboard
Hierarchy negatively affects Port Order
In the following example, the fixed port order gets inverted and crossings are introduced. This occurs as soon as a layout for a fresh diagram with expanded nodes is performed. In other words:
-
Both nodes collapsed -> layout ok
-
Expanding both nodes -> layout ok
-
Updating the diagram (e.g. adding a space in the source code and saving, hence no change in topology) -> layout with unnecessary crossings
-
Collapsing nodes again -> layout still has unnecessary crossings
It seems the layout is able to prevent these crossings but introduces them if the hierarchy is present and no previous layout information is present.
Further information:
- The nodes have a fixed order constraint for ports and the ports have a fixed side.
- I also confirmed that it is not related to Klighd's Incremental Update.
In the attached zip you can find the debug logs for the four layout runs.
I also tried setting HIERARCHY_HANDLING to INCLUDE_CHILDREN, which should activate HALS if I remember correctly, but it made it even worse.
Have you tried to specify LayeredOptions:PORT_INDEX
? It seems to be the case that you set the FIXED_ORDER
as a portConstraint
, however, that order is not specified.
Setting the port constraints to FREE
and adding considerModelOrder.strategy: NODES_AND_EDGES
also seems to work (see here).