Untitled object in Mermaid Config Schema
https://mermaid.js.org/schemas/config.schema.json#/properties/elk| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|---|---|---|---|---|---|---|---|
| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | config.schema.json* |
elk Type
object (Details)
elk Properties
| Property | Type | Required | Nullable | Defined by |
|---|---|---|---|---|
| mergeEdges | boolean | Optional | cannot be null | Mermaid Config |
| nodePlacementStrategy | string | Optional | cannot be null | Mermaid Config |
| nodePlacementAlignment | string | Optional | cannot be null | Mermaid Config |
| preset | string | Optional | cannot be null | Mermaid Config |
| straightenEdges | boolean | Optional | cannot be null | Mermaid Config |
| lineHops | Merged | Optional | cannot be null | Mermaid Config |
| layeringStrategy | string | Optional | cannot be null | Mermaid Config |
| layeringLayerBound | number | Optional | cannot be null | Mermaid Config |
| cycleBreakingStrategy | string | Optional | cannot be null | Mermaid Config |
| forceNodeModelOrder | boolean | Optional | cannot be null | Mermaid Config |
| considerModelOrder | string | Optional | cannot be null | Mermaid Config |
| keepEntryNodeOnTop | boolean | Optional | cannot be null | Mermaid Config |
mergeEdges
Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram.
mergeEdges
is optional
Type:
booleancannot be null
defined in: Mermaid Config
mergeEdges Type
boolean
mergeEdges Default Value
The default value is:
falsenodePlacementStrategy
Elk specific option affecting how nodes are placed.
nodePlacementStrategy
is optional
Type:
stringcannot be null
defined in: Mermaid Config
nodePlacementStrategy Type
string
nodePlacementStrategy Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"SIMPLE" | |
"NETWORK_SIMPLEX" | |
"LINEAR_SEGMENTS" | |
"BRANDES_KOEPF" |
nodePlacementAlignment
Elk specific option affecting Brandes-Koepf node placement alignment. BALANCED combines the four directional alignments; NONE picks the smallest result. Defaults to BALANCED for the default preset and NONE for named non-default presets.
nodePlacementAlignment
is optional
Type:
stringcannot be null
defined in: Mermaid Config
nodePlacementAlignment Type
string
nodePlacementAlignment Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"NONE" | |
"LEFTUP" | |
"LEFTDOWN" | |
"RIGHTUP" | |
"RIGHTDOWN" | |
"BALANCED" |
preset
Named combination of layering, node placement, placement alignment and cycle breaking options. Explicit options override the preset for that option; the remaining preset values still apply.
default — network simplex layering, balanced Brandes-Koepf placement at the top level and inside subgraphs, and depth-first cycle breaking. Balanced placement favors centered branches and composite-state entries, sometimes at the cost of a wider or taller drawing. It does not guarantee that every edge attaches to the center of its target.
legacy — Brandes-Koepf placement with NONE alignment and ELK's own greedy cycle breaking. Reproduces the rendering before presets existed.
modelOrder — network simplex layering and top-level placement, Brandes-Koepf placement inside subgraphs, NONE alignment, and greedy model-order cycle breaking, which favors declaration order.
depthFirst — the previous default: network simplex layering and top-level placement, Brandes-Koepf placement inside subgraphs, NONE alignment, and depth-first cycle breaking.
Setting layeringStrategy, nodePlacementStrategy, nodePlacementAlignment or cycleBreakingStrategy explicitly overrides the preset for that option, including an explicit NONE alignment.
preset
is optional
Type:
stringcannot be null
defined in: Mermaid Config
preset Type
string
preset Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"default" | |
"legacy" | |
"modelOrder" | |
"depthFirst" |
preset Default Value
The default value is:
"default"straightenEdges
Straightens an edge that leaves or enters a node with a tiny step.
ELK spreads an edge's port evenly along a node's side but routes the edge down a channel whose row rarely lines up with that port exactly, leaving a staircase of a few pixels right at the border. With rounded corners the two micro-bends land on top of each other and read as a kink. Enabling this moves the channel onto the port's row and drops the step, so the edge draws as one straight line and both ports stay exactly where the layout put them.
Only the step next to a node is touched, and only when the edge continues the same way afterwards, so a real turn is never collapsed. An edge is left alone entirely when moving its run would drag the far port, or would introduce a crossing.
straightenEdges
is optional
Type:
booleancannot be null
defined in: Mermaid Config
straightenEdges Type
boolean
straightenEdges Default Value
The default value is:
truelineHops
Renders edge crossings as small arcs ("hops") or visible gaps, so that it is clear which line passes over which where two edges meet.
The edge that gives way loses its corner rounding for the segment carrying the hop, which is the trade for a readable crossing. Curved edges are skipped rather than rewritten, to avoid corrupting their geometry. Set to false to draw plain crossings.
lineHops
is optional
Type: merged type (Details)
cannot be null
defined in: Mermaid Config
lineHops Type
merged type (Details)
one (and only one) of
lineHops Default Value
The default value is:
truelayeringStrategy
Elk specific option deciding which layer each node is assigned to — the column in a left-to-right diagram, the row in a top-down one. This is the coarsest of the three placement decisions, so changing it moves nodes further than anything else short of altering spacing.
NETWORK_SIMPLEX aims for the fewest long edges. LONGEST_PATH pushes every node as late as it can go. COFFMAN_GRAHAM bounds how many nodes share a layer, giving a more even, block-like shape on wide graphs. MIN_WIDTH and STRETCH_WIDTH trade edge length for a narrower or wider drawing. INTERACTIVE honours positions already on the nodes.
layeringStrategy
is optional
Type:
stringcannot be null
defined in: Mermaid Config
layeringStrategy Type
string
layeringStrategy Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"NETWORK_SIMPLEX" | |
"LONGEST_PATH" | |
"LONGEST_PATH_SOURCE" | |
"COFFMAN_GRAHAM" | |
"MIN_WIDTH" | |
"STRETCH_WIDTH" | |
"INTERACTIVE" |
layeringLayerBound
Elk specific option capping how many nodes COFFMAN_GRAHAM will put in one layer. Ignored by every other layering strategy. Lower values give a taller, narrower drawing.
layeringLayerBound
is optional
Type:
numbercannot be null
defined in: Mermaid Config
layeringLayerBound Type
number
layeringLayerBound Default Value
The default value is:
4cycleBreakingStrategy
This strategy decides how to find cycles in the graph and deciding which edges need adjustment to break loops.
cycleBreakingStrategy
is optional
Type:
stringcannot be null
defined in: Mermaid Config
cycleBreakingStrategy Type
string
cycleBreakingStrategy Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"GREEDY" | |
"DEPTH_FIRST" | |
"INTERACTIVE" | |
"MODEL_ORDER" | |
"GREEDY_MODEL_ORDER" |
forceNodeModelOrder
The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.
forceNodeModelOrder
is optional
Type:
booleancannot be null
defined in: Mermaid Config
forceNodeModelOrder Type
boolean
forceNodeModelOrder Default Value
The default value is:
falseconsiderModelOrder
Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.
considerModelOrder
is optional
Type:
stringcannot be null
defined in: Mermaid Config
considerModelOrder Type
string
considerModelOrder Constraints
enum: the value of this property must be equal to one of the following values:
| Value | Explanation |
|---|---|
"NONE" | |
"NODES_AND_EDGES" | |
"PREFER_EDGES" | |
"PREFER_NODES" |
considerModelOrder Default Value
The default value is:
"NODES_AND_EDGES"keepEntryNodeOnTop
Elk specific option that keeps the entry node of a recursive flow at the top of the layout.
When a flow loops back on itself (a back-edge to an earlier node), ELK's degree-based cycle-breaking has no notion of an "entry point" and may rank the first-declared node in the middle, scrambling the reading order. When enabled, the entry node of each cyclic component is pinned to the first layer so the diagram still reads from its entry. Acyclic flows always have a natural source, so this has no effect on them.
Only applies when the cyclic flow has no node without incoming edges: if the loop is fed from outside (e.g. a start node pointing into it), that component already has a natural source and nothing is pinned. Detection is also scoped per container, so cycles that cross a subgraph boundary are not detected.
keepEntryNodeOnTop
is optional
Type:
booleancannot be null
defined in: Mermaid Config
keepEntryNodeOnTop Type
boolean
keepEntryNodeOnTop Default Value
The default value is:
false