Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,10 @@ export const getELKLayoutedElements = async (

const nodeHeight = getNodeHeight(node, isColumnOnlyFilterActive, columns);

const nodeDepth = node.data?.nodeDepth;

return {
id: node.id,
width: NODE_WIDTH,
height: nodeHeight,
...(nodeDepth !== undefined && {
layoutOptions: {
'elk.partitioning.partition': String(nodeDepth),
},
}),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ describe('ELKLayout', () => {
'elk.direction': 'RIGHT',
'elk.spacing.nodeNode': '80',
'elk.layered.spacing.nodeNodeBetweenLayers': '200',
'elk.layered.nodePlacement.strategy': 'SIMPLE',
'elk.partitioning.activate': 'true',
'elk.layered.nodePlacement.strategy': 'BRANDES_KOEPF',
'elk.layered.nodePlacement.bk.fixedAlignment': 'BALANCED',
});
});

Expand Down Expand Up @@ -344,13 +344,18 @@ describe('ELKLayout', () => {
).toBe('200');
});

it('uses simple node placement strategy', () => {
it('uses brandes-koepf node placement with balanced alignment', () => {
expect(ELKLayout.layoutOptions['elk.layered.nodePlacement.strategy']).toBe(
'SIMPLE'
'BRANDES_KOEPF'
);
expect(
ELKLayout.layoutOptions['elk.layered.nodePlacement.bk.fixedAlignment']
).toBe('BALANCED');
});

it('activates partitioning', () => {
expect(ELKLayout.layoutOptions['elk.partitioning.activate']).toBe('true');
it('does not activate partitioning so ELK derives layers from edges', () => {
expect(
ELKLayout.layoutOptions['elk.partitioning.activate']
).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ class ELKLayout {
'elk.direction': 'RIGHT',
'elk.spacing.nodeNode': '80',
'elk.layered.spacing.nodeNodeBetweenLayers': '200',
'elk.layered.nodePlacement.strategy': 'SIMPLE',
'elk.partitioning.activate': 'true',
// Let ELK derive layers from edge topology instead of pinning nodes to a
// backend-provided nodeDepth. Partitioning forced a multi-branch node into
// the column of its first depth, misaligning its other edges.
'elk.layered.nodePlacement.strategy': 'BRANDES_KOEPF',
// BALANCED averages Brandes-Köpf's four extreme alignments into a centroid.
// Without it, a symmetric source (e.g. equal upstream/downstream branches)
// has multiple optimal placements and ELK snaps to a top-aligned corner
// instead of sitting vertically centered between its neighbors.
'elk.layered.nodePlacement.bk.fixedAlignment': 'BALANCED',
};

constructor() {}
Expand Down
Loading