Skip to content

Compare

ireko does one thing: it lays out a tree of containers, with a different layout for each container. Other libraries do other things better. This page helps you select one.

You haveUse
Nested groups, and each group needs its own arrangement (a grid of rings of trees)ireko
React Flow sub-flows that need sizes and positionsireko (layoutFlow), or ELK
A small flowchart in one containerireko (layers)
A large directed graph with layers (a dependency graph)dagre, or ELK layered
Ports, edge labels with their own space, and many optionsELK
One tree, with tidy layers and nodes of different sizesd3-flextree
A network with no hierarchyd3-force, Cytoscape.js with fCoSE, or ELK stress
A diagram from a text in MarkdownMermaid, or Graphviz
irekodagreELK (elkjs)d3-hierarchyCytoscape.jsGraphviz (WASM)
Main algorithmgrid, radial, tidy tree, layers, yours, in each containerlayeredlayered and 10 moretidy tree, treemap, packmany, as extensionsdot, neato, osage and more
Nested containersyes, each with its own strategy and modeclusters, with settings for each cluster (3.1)yes, from the leaves uptreemap and pack onlyyes (compound nodes)clusters
Your own algorithma small arrange functionnoJava or a forknoan extensionno
Edge routesstraight, orthogonal, around boxes, yourspolylineorthogonal, polyline, splinesnoby the renderersplines, orthogonal
Audit of the outputyes, in each layoutnonononono
Text languageyesnono (JSON)nonoDOT
RenderersSVG, DOM, Canvas, React, React Flownononoits ownSVG
APIsynchronoussynchronousasynchronous (worker)synchronoussynchronousasynchronous (WASM)
Size, min + gzip13 KB17 KB467 KB6 KBnot measurednot measured (WASM)
LicenseMITMITEPL-2.0ISCMITEPL-1.0 (Graphviz)

The sizes are measurements of the minified bundle after gzip, in October 2026: ireko 0.1, @dagrejs/dagre 3.1.1, elkjs 0.12.0 (elk.bundled.js) and d3-hierarchy 3.1.2.

Good layout engines for nested graphs do the same thing at the core. They lay out the inside of each group first, then the group. ireko does that too, with two passes. The difference is the unit of choice.

  • ELK has elk.algorithm on each compound node, and lays out from the leaves up by default. It has a very large set of options, and its JSON model has ports and label space. The React Flow guide names it the most configurable layout library, and also the most complex.
  • dagre 3.1 has settings for each cluster: direction and spacing. The algorithm is always layered.
  • Graphviz osage lays out each cluster first, then packs the clusters. Each cluster can set its own packing.
  • Cytoscape.js sizes a compound node from its children. To use a different layout for each compound, you lay out each subset by hand.
  • ireko makes the strategy and the mode two settings of each node, and nothing more. A grid container can hold a ring that holds a tree. Each strategy is a function of one level, so a new strategy is short.
  • A small layered layout. The layers strategy orders each layer by the mean place of the neighbors. It has no global crossing reduction and no placement that straightens long edges. For a large graph with long chains, use dagre or ELK.
  • No ports. An edge starts at the border of a box, on the line to the other box.
  • No edge label space. A label goes at the middle of its route, on top of the line. The layout does not keep space for it.
  • No edge bundling. The avoid router goes around boxes, but it does not keep edges apart from each other, and it does not reduce crossings between edges.

The plan of the project has a tree strategy, a stack strategy and an obstacle router as next steps.

A strategy is a function of one level, so a strategy can wrap another library. For example, a layered strategy can give the children of one container to dagre, and give back the offsets. The other containers keep grid and radial. The strategy guide has the contract.