Choose Graphviz when an application generates dependency diagrams and needs explicit SVG node identifiers for links, checks or downstream processing. Choose Mermaid when people will maintain diagrams as readable text alongside documentation. For both tools, use stable record IDs separately from display labels: two steps called Review must not become one step.
We rendered the same five-record workflow through Graphviz and Mermaid, then inspected the SVG. Both retained five nodes and five edges, including two distinct Review nodes. Graphviz honored all five explicit SVG IDs we supplied. Mermaid generated its own IDs containing the source node names. An additional unquoted lowercase end broke Mermaid parsing; the quoted display label worked. This small result makes identifier handling a concrete acceptance criterion rather than a diagram beauty contest.
Compare the diagram’s downstream job
| Tool | Best fit in this decision | Executed observation | Control to retain |
|---|---|---|---|
| Graphviz | Generated graph output with explicit SVG IDs | 5 nodes, 5 edges; record-n1 through record-n5 retained | Separate record IDs, labels and output attributes |
| Mermaid | Text diagrams reviewed with documentation | 5 nodes, 5 edges; quoted end label rendered | Quote labels, keep opaque source IDs and check generated output |
Graphviz
The DOT language separates graph structure from attributes. Graphviz’s id attribute can assign an output identifier to a node. We used that directly: source node n2 had the display label Review and SVG ID record-n2; n3 had the same label and SVG ID record-n3.
Our execution used Graphviz 16.1.0 through @viz-js/viz 3.31.0, with the dot layout engine and SVG output. Viz.js exposes a WebAssembly interface; this was not a desktop installation of the dot executable. The distinction matters when you reproduce renderer versions or package dependencies.
The practical strength is a direct mapping from your own records to output elements. The limitation is that an explicit ID is your responsibility: supplying duplicate IDs would still be a bad integration. The test did not establish any advantage for layout quality, huge graphs, rendering speed or editor collaboration.
Mermaid
Mermaid’s flowchart syntax supports a node ID with a separate quoted label. The same documentation warns about lowercase end. In our 12.2.0 execution, A --> end failed parsing, while n5["end"] rendered as intended.
We used Mermaid’s JavaScript rendering interface in Chrome, securityLevel strict, HTML labels disabled and the Dagre layout explicitly selected. The layout selection is part of this reproducibility record, not a statement about the defaults in every Mermaid version or documentation platform.
The resulting IDs included toolgraph-flowchart-n2-1 and toolgraph-flowchart-n3-2. They distinguished our records in this output, but they include generated structure. We would not use those full strings as a permanent external API without pinning and checking the renderer. Mermaid fits a documentation workflow when the host supports its source format; host-specific rendering and sanitization still need their own verification.
The complete workflow fixture
Five records were labeled Intake, Review, Review, Budget (USD) and end. The edges were n1→n2, n1→n3, n2→n4, n3→n4 and n4→n5. Only four labels were unique. A generator keyed by label would therefore lose a record before either rendering engine got a chance to help.
This is the Mermaid source that rendered successfully:
flowchart LR
n1["Intake"]
n2["Review"]
n3["Review"]
n4["Budget (USD)"]
n5["end"]
n1 --> n2
n1 --> n3
n2 --> n4
n3 --> n4
n4 --> n5
The corresponding DOT source made output IDs explicit:
digraph G {
rankdir=LR;
n1 [id="record-n1",label="Intake"];
n2 [id="record-n2",label="Review"];
n3 [id="record-n3",label="Review"];
n4 [id="record-n4",label="Budget (USD)"];
n5 [id="record-n5",label="end"];
n1 -> n2; n1 -> n3;
n2 -> n4; n3 -> n4; n4 -> n5;
}
We counted Graphviz’s g.node and g.edge SVG groups, and Mermaid’s g.node groups and flowchart-link elements. Both counts matched the five-node/five-edge input. We also checked the labels and inspected the rendered images. Counting alone would not prove the edges join the correct records, so the small fixture’s actual topology was visually reviewed as well.
Use identity as the acceptance test
For generated diagrams, start with a source-record inventory and verify that each record survives, even when labels repeat or change. Then check edges, output IDs and the final display. A syntactically valid picture does not prove the modeled approval process is correct, acyclic or compliant; neither renderer was asked to enforce business rules here.
Graphviz is the stronger fit for our specific requirement of assigning record-based SVG IDs directly. Mermaid is the simpler source format to consider for a text-authored documentation flowchart. Both passed the actual semantic fixture, so the evidence supports choosing by integration contract rather than declaring one universally better.
Licensing also belongs in packaging review: Graphviz publishes its Eclipse Public License terms, while Mermaid publishes an MIT license. The wrapper and bundled dependencies have their own notices. We did not evaluate paid hosting or collaboration plans. If people need to workshop and govern process maps, see process-mapping software; publishing a developer reference is separately covered by our API documentation comparison.
Methodology and limitations
Toolverly Editorial executed the two renderers on 17 October 2026 on macOS arm64 with Node 26.0.0 and Chrome 155.0.8059.84. We retained the record list, both source documents, SVGs, screenshots, output IDs and parser error. Primary syntax, API and license sources were checked the same day.
We did not test large-graph performance, team collaboration, a proprietary Mermaid service or documentation-host integrations. This is a local five-record functional comparison, not a usability study or general layout ranking. The lowercase end case is a parser constraint, and the duplicate-label hazard originates in the generator’s identity policy.
By Toolverly Editorial. AI assistance was used to prepare code, research and prose; the local examples were executed and their outputs reviewed before publication.
Photo by UX Indonesia on Unsplash. Read about our publication or send a correction.
