-
Notifications
You must be signed in to change notification settings - Fork 0
wrap: true folds by layer, so the main chain stops reading in order #22
Description
Split out of #18, whose "neighbouring problem" section this is. #21 fixes that issue's stranded arrowhead; this half is untouched by it.
What happens
wrap: true gives the best aspect ratio of anything we produce, but it folds on ELK's layer index, not on the chain. The main chain therefore stops being contiguous: a reader following it is sent backwards up the page.
Measured over the bundled examples and the agent-run diagrams, all forced to wrap: true — reading rank of each node on the longest forward chain, in reading order (row band, then x):
examples/enterprise.yaml rank=[6,3,4,5,8,19,10,11,12,13,14,15] 2 inversions
examples/growth.yaml rank=[5,1,2,3,6,9,21,12,13] 2 inversions
codex round 2 rank=[5,7,8,2,1,3,4,6] 2 inversions
agy round 2 rank=[2,3,6,7,8,0] 1 inversion — the chain ends at rank 0
examples/startup.yaml rank=[0,1,2,3] reads in order
examples/web-app.yaml rank=[0,1,4,5,6] reads in order
The last node of the agy round-2 diagram lands top-left. In an earlier round the pipeline's first node ended up bottom-right.
Why it cannot be done through ELK
Investigated while fixing #18:
- ELK cuts by layer index. Reordering nodes before handing them over does not move a cut.
elk.layered.wrapping.cutting.strategy: MANUALwithcutting.cutsis the only option that places the folds explicitly, and it cannot be set from elkjs: the list type is not registered withElkReflect, so the call throwsCouldn't create new instance of property 'org.eclipse.elk.layered.wrapping.cutting.cuts'.elk.layered.considerModelOrder.strategyin all three modes (NODES_AND_EDGES,NODES,PREFER_EDGES) changed the output by not one pixel.
So the fold has to become ours: lay out once to get the chain order, partition it into rows, and emit each row for ELK to place — which is the "wrap becomes generated groups" shape.
Open question before starting
How a generated row interacts with a group the user wrote, when a group spans a row boundary. That has no answer yet, and it is the reason this is not a small change.
The detour warning added in 0.7.5 already names the fold as the cause, which is honest but does not make the picture readable.