Skip to content

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

@belamajoros

Description

@belamajoros

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions