elkjs
elkjs copied to clipboard
Encourage nodes to be in upper layers
Hi,
Is there any way to encourage ELK to place nodes in the upper layers of a graph? For example, in the below image, making the circled node move up a layer (where the arrow is pointing to) so the edge is shorter at the top and longer at the bottom?
My current layout options are:
defaultLayoutOptions: {
"elk.algorithm": "layered",
"elk.edgeRouting": "ORTHOGONAL",
// Encourage ELK to layout in a symmetric way.
"elk.layered.nodePlacement.favorStraightEdges": "false",
"elk.layered.crossingMinimization.semiInteractive": "true",
// Maintain the order that we specified in.
"elk.layered.considerModelOrder": "NODES_AND_EDGES",
// Layout downwards.
"elk.direction": "DOWN",
// Spacing of nodes and layers.
"elk.spacing.nodeNode": "20",
"elk.spacing.edgeNode": "20",
"elk.layered.spacing.nodeNodeBetweenLayers": "0",
}
Thanks for your help!
There's an option priority.shortness
. It has to be set manually on the edges though. In other words, you'd have to know upfront, which edges you want to be shorter.