Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subflows with MRTREE algorithm - incorrect position and width calculation #294

Open
belamajoros opened this issue Aug 1, 2024 · 1 comment
Labels

Comments

@belamajoros
Copy link

Hi, when using the mrtree algorithm with subflows, the position of the nodes inside of the subflow is incorrectly calculated. Also in case of a subflow inside a subflow, the width of the parent subflow is also incorrectly calculated and part of the child subflow gets placed outside of its parent subflow.

example for elklive:
{
id: "root",
layoutOptions: {
'algorithm': 'mrtree',
'elk.direction': 'DOWN',
'elk.spacing.nodeNode': '50',
},
children: [
{ id: "n1", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP'} },
{ id: "n2", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP'} },
{ id: "n3", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP', 'elk.algorithm': 'mrtree', 'elk.direction': 'DOWN'}, children: [
{ id: "n7", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP' }},
{ id: "n8", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP'}}
]},
{ id: "n4", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP'} },
{ id: "n6", width: 30, height: 30, layoutOptions: { 'elk.alignment': 'TOP'} }
],
edges: [
{ id: "e1", sources: [ "n1" ], targets: [ "n2" ] },
{ id: "e4", sources: [ "n1" ], targets: [ "n3" ] },
{ id: "e3", sources: [ "n2" ], targets: [ "n4" ] },
{ id: "e5", sources: [ "n1" ], targets: [ "n6" ] },
]
}

Screenshots
image
image

This in itself would not be a huge problem as I am able to correctly position the nodes inside the subflow after calling elk.layout().

Regarding the incorrect parent subflow width:

Screenshots
If the subflow is on the right side of the branch (incorrect):
image
If the subflow is on the left side of the branch (correct):
image

ELK Version
0.9.3
algorithm: mrtree

@belamajoros belamajoros added the bug label Aug 1, 2024
@Eddykasp
Copy link
Collaborator

Eddykasp commented Aug 1, 2024

This is indeed a bug, minimally reproduced in this example. The problem seems to be in the position and size calculation of the graph after layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants