elk
elk copied to clipboard
Exception with edge labels when using fixed positioned ports.
When using FIXED_POS port constraints and a self loop involving two ports on the same side, an exception is thrown if the edge has a label.
UnsupportedConfigurationException: Node 'n1.n2.p2' has its layer constraint set to FIRST_SEPARATE, but has at least one incoming edge. FIRST_SEPARATE nodes must not have incoming edges.
Example graph:
elk.direction: RIGHT
hierarchyHandling: SEPARATE_CHILDREN
algorithm: org.eclipse.elk.layered
node n1 {
portConstraints: FREE
node n2 {
nodeSize.constraints: "[PORTS]"
insideSelfLoops.activate: true
nodeSize.options: "[DEFAULT_MINIMUM_SIZE]"
portConstraints: FIXED_POS
port p1 {
layout [
size: 23.11979103088379, 40
position: 0, 31
]
org.eclipse.elk.^port.side: WEST
}
port p2 {
layout [
size: 23.11979103088379, 40
position: 0, 81
]
org.eclipse.elk.^port.side: WEST
}
}
edge e1: n2.p1 -> n2.p2 {
insideSelfLoops.yo: true
label "fs"
}
}
Removing the label produces desired results. Deactivating the self loops produces an undesirable layout.
Deactivating the self loops produces an undesirable layout.
I presume you mean deactivating inside selfloops.
I could imagine that this is a case nobody checked beforehand. You'd have, internally, two external port dummies for the ports and a label dummy for the edge label. Both port dummies get assigned FIRST_SEPARATE
and are connected via dummy edges to the label dummy. And likely the edges are introduced in a generic fashion resulting in one of them pointing into the "wrong" direction.
Reversing one of the edge directions seems to work, though you'd have to manually check this case and then flip one (this is only as a workaround, not a fix)
An inside self-loop between nodes of the same side essentially creates an in-layer edge, which is currently not supported by ELK.
I suggest adding a node to route the edge trough to solve this problem:
elk.direction: RIGHT
hierarchyHandling: SEPARATE_CHILDREN
algorithm: org.eclipse.elk.layered
node n1 {
portConstraints: FREE
node n2 {
elk.direction: RIGHT
nodeSize.constraints: "[PORTS, PORT_LABELS]"
insideSelfLoops.activate: true
nodeSize.options: "[DEFAULT_MINIMUM_SIZE]"
portConstraints: FIXED_POS
port p1 {
layout [
size: 23.11979103088379, 40
position: 0, 31
]
org.eclipse.elk.^port.side: WEST
}
port p2 {
layout [
size: 23.11979103088379, 40
position: 0, 81
]
org.eclipse.elk.^port.side: WEST
}
node dummy {
layout [size: 1, 1]
portConstraints: FIXED_SIDE
port north {
^port.side: NORTH
}
port south {
^port.side: SOUTH
}
}
edge p1 -> dummy.north {
insideSelfLoops.yo: true
label "fs"
}
edge dummy.south -> p2 {
insideSelfLoops.yo: true
label "fs"
}
}
// edge e1: n2.p1 -> n2.p2 {
// insideSelfLoops.yo: true
// label "fs"
// }
}
``