dagre
Reasonable, with limits. 7th of 9 diagrams and node graphs.
dagre is a small, fast layout engine. It works out x/y positions for nodes and edges in a directed graph, and you draw them yourself or through React Flow or Cytoscape.js. It was revived in 2025–2026 with a TypeScript rewrite (v3), and it is a solid simple choice for tree-like and hierarchical layouts. elkjs is the better pick when you need edge routing, sub-flows or fine control.
Best for: Developers who need quick top-down or left-right layouts for flowcharts and trees in React Flow, Cytoscape.js or their own SVG.
Scores
Overall6.7
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
A good, light pick for simple layered layouts, and now maintained again with modern TypeScript packaging. It only does layout, and elkjs does that job better for anything beyond trees and plain flowcharts. Its upkeep rests on one person. The range stays moderate because the revival is recent and its track record is short.
- reactflow.dev/learn/layouting/layouting: Recommended for simple trees; ELK for complex needs
- npm latestPublishedAt: Release in October 2026
- peers elkjs: elkjs has faster growth and more dependent repos
GPT-6.2 Sol: 7.4, likely 6.2 to 8.5
Dagre is a strong choice when a new project needs automatic layout for a straightforward directed graph and already has a renderer. The current release has modern packaging and active maintenance, but recent ordering and cluster issues make the recommendation depend on graph structure. ELK.js is a better choice for advanced routing and nested groups, while Mermaid and React Flow cover text-authored diagrams and interactive graph interfaces respectively.
- reactflow.dev/learn/layouting/layouting: Shows where Dagre is simple to integrate and where ELK.js adds control.
- raw.githubusercontent.com/dagrejs/dagre/v3.1.3/changelog.md: Current release fixes module exports and several layout problems.
- github.com/dagrejs/dagre/issues: Open current reports cover sibling ordering, clusters, and edge paths.
- eclipse.dev/elk/reference/algorithms/org-eclipse-elk-layered.html: ELK Layered supports port constraints and edges across nested groups.
- mermaid.js.org/intro/syntax-reference.html: Mermaid renders diagrams from text and offers both ELK and Dagre layouts.
Needed by many3.6
How many developers need a tool for this job?
Claude Opus 5.5: 3.5, likely 2.5 to 5.0
It only computes layered graph layouts. It draws nothing and does not let people sketch. Developers who build node editors, flowcharts or dependency graphs need it, but that is a clear niche within the category.
- github description: Directed graph layout for JavaScript, layout only
- reactflow.dev/learn/layouting/layouting: Used as a layout add-on for React Flow, not as a renderer
GPT-6.2 Sol: 3.6, likely 2.5 to 4.8
Automatic directed layout solves a recurring problem in workflow builders, dependency viewers, and tree diagrams. Dagre can work with any renderer, but it covers only the layout step of diagramming. The share of JavaScript and TypeScript projects that need this step is uncertain.
- github.com/dagrejs/dagre/wiki: Explains the layout inputs and outputs and the need for a separate renderer.
- reactflow.dev/examples/layout/dagre: Shows how an interactive graph renderer uses Dagre for tree layout.
- apache.googlesource.com/flink/%2B/292f36fecbd821e4215642e666e3dc6080927eb1: Shows use in a job dependency graph.
Helps a lot6.9
How well does it do the job for those who need it?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
It is fast and easy for hierarchical layouts, and v3 adds native TypeScript types and per-cluster settings. It has few options and no edge routing, has a known sub-flow bug, and blocks the main thread on large graphs. elkjs and d3-dag give better layouts for complex graphs. Its long history means AI agents write working code for it, though they sometimes pick the old unscoped package.
- reactflow.dev/learn/layouting/layouting: Simple and fast, but no edge routing and a sub-flow bug
- raw.githubusercontent.com/dagrejs/dagre/master/changelog.md: v3 TypeScript rewrite, per-cluster options, fixes for nested clusters
- erikbrinkman.github.io/d3-dag: d3-dag offers a drop-in replacement with better crossing minimisation
- npm hasTypes: Ships its own types
GPT-6.2 Sol: 7.7, likely 6.3 to 8.6
Version 3.1.3 gives teams a straightforward typed API for laying out directed graphs with varying node sizes. React Flow's comparison favors Dagre for simple trees and shows that ELK.js offers more routing control. The wiki's older import example can mislead developers and coding agents, and users have reproduced cluster boundary and sibling ordering problems on 3.1.3. How much those problems matter depends on the structure of the graph.
- raw.githubusercontent.com/dagrejs/dagre/v3.1.3/package.json: Confirms bundled types and entry points for ESM and CommonJS.
- reactflow.dev/learn/layouting/layouting: Compares setup, variable node sizes, and routing across layout engines.
- github.com/dagrejs/dagre/wiki: Documents dimensions and bend points using the old unscoped import.
- github.com/dagrejs/dagre/issues/528: Reports children outside their group with the longest-path ranker on 3.1.3.
- github.com/dagrejs/dagre/issues/530: Compares sibling ordering on 3.0.0 and 3.1.3.
Holds up over time6.4
Will it still be a good choice in two years?
Claude Opus 5.5: 6.0, likely 4.5 to 7.5
After years of little activity, the project shipped 117 commits and 8 npm versions in the last year, including v3 and v3.1.3 in October 2026. The work seems to rest mostly on one maintainer with no visible funding. There are 171 open issues against 176 closed. The CJS file rename in 3.1.3 shows that small breaking changes can still happen.
- github commitsLastYear: 117 commits, last push October 2026
- npm versionsLastYear: 8 versions, latest 3.1.3
- github.com/dagrejs/dagre/releases: Recent GitHub releases published by one maintainer (rustedgrail)
- github openIssues: 171 open vs 176 closed
GPT-6.2 Sol: 6.8, likely 5.3 to 8.0
Dagre had 117 commits and eight npm versions in the past year, and the October patch fixed packaging and layout bugs. The TypeScript migration changed some exported types, users reported ordering changes in 3.1, and Mermaid moved its default flowchart layout to ELK. The open issue backlog and limited visibility into who can publish or fund the work make the two-year outlook less certain.
- github commitsLastYear, openIssues, openPullRequests: 117 commits, 171 open issues, and three open pull requests.
- npm versionsLastYear, latestPublishedAt: Eight npm versions and a stable October 2026 update.
- raw.githubusercontent.com/dagrejs/dagre/v3.1.3/changelog.md: Records the TypeScript migration and current patch fixes.
- apache.googlesource.com/flink/%2B/292f36fecbd821e4215642e666e3dc6080927eb1: Flink had to replace the GraphEdge type during migration.
- github.com/dagrejs/dagre/issues/530: User reports an undocumented change in default ordering.
- mermaid.ai/open-source/config/layouts.html: Mermaid 12 made ELK the default for several diagram types.
Used widely5.4
How many use it, and is that growing?
Claude Opus 5.5: 6.0, likely 5.0 to 7.5
34M downloads in 4 weeks, up 10.6x on a year ago, which beats the 4.1 median. Peers like elkjs (21x) and React Flow (14x) grew faster. Much of the volume comes through other tools, such as cytoscape-dagre, which bundles it, and React Flow setups. The old unscoped dagre package also still takes a share. The ecosyste.ms dependents count (13 packages) looks far too low and is not reliable here.
- npm downloadsLast4Weeks: 34.2M vs 3.2M a year ago
- medianDownloadsRatio: Median 4.1; dagre is at 10.6
- dependents: 1 repo, 13 packages, likely undercounted
- cdn.jsdelivr.net/npm/cytoscape-dagre@4.0.1/README.md: cytoscape-dagre bundles dagre v3
GPT-6.2 Sol: 4.8, likely 3.3 to 6.3
Four-week downloads rose from 3.23 million to 34.17 million, or 10.6× year over year. That beats the 4.1× catalog baseline and trails ELK.js at 21.2×. Automated and transitive installs raise the download count, while bundled copies can escape it. npm lists 526 dependent packages and ecosyste.ms found just one repository and 13 packages, so the scale of direct adoption is hard to pin down.
- npm downloadsLast4Weeks, downloadsSame4WeeksYearAgo, medianDownloadsRatio: 10.6× growth against a 4.1× catalog baseline.
- peers, dependents, github stars, bluesky posts: ELK.js grew faster and has far more indexed repositories. Dagre has 5,863 stars and one Bluesky link post.
- npmjs.com/package/%40dagrejs/dagre?activeTab=versions: npm lists 526 dependent packages and substantial installs across several major versions.
- raw.githubusercontent.com/n8n-io/n8n/n8n@3.2.2/packages/@n8n/workflow-sdk/package.json: The n8n workflow SDK pulls in Dagre 1.x as a dependency.
- github.com/cytoscape/cytoscape.js-dagre: The Cytoscape extension bundles Dagre 3 without a separate install.
Vouched for6.8
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 4.5 to 7.0
React Flow's docs recommend it, and Cytoscape.js's official dagre extension builds on it. Mermaid uses a fork (dagre-d3-es). It has no survey data, no HN discussion and almost no Bluesky attention. Independent write-ups tend to describe it as the simple option and point to ELK for quality.
- reactflow.dev/examples/layout/dagre: Official React Flow dagre example
- github.com/cytoscape/cytoscape.js-dagre: Official Cytoscape.js layout extension
- calm.finos.org/calm-studio/adrs/use-elk-for-auto-layout: A FINOS ADR compared it with ELK and chose ELK
- hackerNews stories / bluesky posts: 0 stories, 1 post
GPT-6.2 Sol: 7.6, likely 6.3 to 8.7
Apache Flink adopted Dagre 3 for its job graph dashboard, and the Cytoscape.js extension ships Dagre 3 for layered layouts. React Flow recommends it for simple trees and provides a working example. These are current endorsements for specific uses, with little survey evidence on satisfaction across projects.
- apache.googlesource.com/flink/%2B/292f36fecbd821e4215642e666e3dc6080927eb1: Flink migrated its dashboard to the maintained 3.x package in July 2026.
- github.com/cytoscape/cytoscape.js-dagre: Cytoscape's layout extension ships Dagre 3.
- reactflow.dev/learn/layouting/layouting: React Flow compares several engines and recommends Dagre for simple trees.
- 2025.stateofjs.com/en-US/libraries: The survey does not report a Dagre satisfaction or retention figure.
Safe6.9
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
It has no known advisories, one runtime dependency (its sister package graphlib), an MIT licence and no history of supply-chain incidents. The OpenSSF Scorecard is weak at 4.4: no security policy, unpinned dependencies, broad token permissions and little code review. Releases appear to come from a single maintainer.
- advisories total: 0 advisories
- npm dependencies: 1 dependency
- scorecard score: 4.4; Security-Policy, Pinned-Dependencies and Token-Permissions score 0
- github license: MIT
GPT-6.2 Sol: 6.8, likely 5.4 to 8.0
Dagre uses the permissive MIT license, has one pinned runtime dependency, and has no recorded OSV advisories for the scoped package. Its OpenSSF Scorecard is 4.4, with weak branch protection and review and zero scores for token permissions, dependency pinning in workflows, and a security policy. The checked-in release script calls npm publish directly, and the number of authorized publishers is unverified.
- advisories total, last24Months: OSV lists zero advisories for the scoped package.
- scorecard score, checks: Weak repository controls and no score for release signing or packaging.
- raw.githubusercontent.com/dagrejs/dagre/v3.1.3/package.json: MIT license, Graphlib pinned to 4.0.6, and tests in the prepublish script.
- raw.githubusercontent.com/dagrejs/dagre/v3.1.3/src/release/release.sh: Documents direct npm publishing after build and release checks.
Good
- Simple, synchronous API that returns positions you can render in any style, about 25 KB with one dependency.
- Version 3 is written in TypeScript and ships its own types, ESM and CJS builds.
- React Flow's layout guide recommends it as the easy default for tree-shaped flows.
- Releases became active again in 2026, adding per-cluster settings and bug fixes for nested clusters.
Bad
- No real edge routing, and sub-flow layout breaks when sub-flow nodes connect to nodes outside it.
- Few options, and layout quality is lower than ELK or d3-dag on complex graphs.
- The scoped and unscoped package names, plus forks like dagre-d3-es, confuse users and AI agents.
- Releases appear to rest mostly on one maintainer, and open issues equal closed ones.
The numbers
- npm downloads, 4 weeks
- 34M ×11 in a year
- GitHub stars
- 5.9k
- Commits, 12 months
- 117
- npm version
- 3.1.3 Oct 2026
- Versions, 12 months
- 8
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 4.4 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (dagrejs/dagre), npm (@dagrejs/dagre), OSV and the OpenSSF Scorecard.
Diagrams and node graphs
- 8.6React Flow
- 8.5Mermaid
- 7.6Cytoscape.js
- 7.4elkjs
- 7.4sigma.js
- 7.3Excalidraw
- 6.7dagre
- 6.7JointJS
- 6.3vis-network