elk icon indicating copy to clipboard operation
elk copied to clipboard

Hierarchy negatively affects Port Order

Open a-sr opened this issue 4 years ago • 3 comments

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:

  1. Both nodes collapsed -> layout ok
    collapsed_good

  2. Expanding both nodes -> layout ok
    expanded_good

  3. Updating the diagram (e.g. adding a space in the source code and saving, hence no change in topology) -> layout with unnecessary crossings
    expanded_bad

  4. Collapsing nodes again -> layout still has unnecessary crossings
    collapsed_bad

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.

a-sr avatar Dec 23 '20 13:12 a-sr

I also tried setting HIERARCHY_HANDLING to INCLUDE_CHILDREN, which should activate HALS if I remember correctly, but it made it even worse. expanded_include_children_bad

a-sr avatar Dec 23 '20 13:12 a-sr

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.

soerendomroes avatar Mar 03 '22 10:03 soerendomroes

Setting the port constraints to FREE and adding considerModelOrder.strategy: NODES_AND_EDGES also seems to work (see here).

soerendomroes avatar Mar 03 '22 10:03 soerendomroes