Skip to content

[Question] How to force top-edge alignment of nodes within a layer when nodes have different heights? #1187

Description

@pkotchavS2024

I have a layered graph with direction: DOWN. In a given layer, nodes may have different heights. When one of the smaller nodes has an edge to a child in the layer below, that node gets "pulled down" and no longer aligns by its top edge with the other nodes in the same layer. Instead, it appears to be placed about the center of the tallest node's height in the layer.
See this example graph

If I remove the edge(s) to the child node, all nodes in the layer align correctly by their top edges.
Updated example graph with last layer of links removed

I've tried experimenting with some options below which didn't quite workout like:
elk.alignment: TOP
nodePlacement.favorStraightEdges: false
nodePlacement.strategy: SIMPLE, LINEAR_SEGMENTS, NETWORK_SIMPLEX

Expected behavior:
All nodes in the same layer should have the same Y position (top-edge aligned), regardless of whether they have edges to child nodes in the layer below like this screenshot below.

Image

Is there a configuration option or combination of options that can strictly enforce top-edge alignment within a layer?

Thanks for any help/advice

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionRequest for support in using ELK.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions