Expose ELK edgeEdgeBetweenLayers spacing - #2887
Open
jonapoul wants to merge 2 commits into
Open
Conversation
The spacing between edges routed between the same pair of layers was hardcoded to 50 in elkOpts, so it could not be configured from the CLI. ELK gives every connector crossing between two layers its own routing slot, and the orthogonal router sizes the gap as max(nodeNodeBetweenLayers, (slots-1)*edgeEdgeBetweenLayers + 2*edgeNodeBetweenLayers). On a wide graph with many links between adjacent layers the first term stops mattering, so layers get pushed far apart with no way to pull them back. ELK's own default for this option is 10. Move the field onto ConfigurableOpts and add --elk-edgeEdgeBetweenLayers alongside the other four spacing flags. It has to move rather than be duplicated: elkOpts embeds ConfigurableOpts, so a depth-0 field with the same tag would shadow the embedded one and keep the hardcoded value. The default stays 50, so behaviour is unchanged unless the flag is passed.
jonapoul
marked this pull request as ready for review
September 8, 2026 09:53
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



ELK's
edgeEdgeBetweenLayersspacing is hardcoded to 50, so there's no way to change it.Every edge between two layers gets its own routing slot, and each slot adds this much space. So the more links you have between two layers, the further apart ELK pushes them. Lowering
--elk-nodeNodeBetweenLayersdoesn't help, because it only sets a minimum. Especially noticeable in tall charts like #1221 (comment).On a 6x6 graph with 36 edges between two layers:
--elk-edgeEdgeBetweenLayerselk-go's own default is 10, for reference.
This adds a
--elk-edgeEdgeBetweenLayersflag, next to the other four spacing flags. The default stays 50, so nothing changes unless you pass it.The field had to move onto
ConfigurableOptsrather than be copied, becauseelkOptsembedsConfigurableOptsand would otherwise shadow it and keep the old hardcoded value.Related to #1221.