Graphviz Viewer

Write or paste a DOT graph and see it drawn as you type, with Graphviz itself compiled to WebAssembly. Eight layout engines, SVG and PNG export. Nothing leaves your browser.

Layers, for directed graphs: flowcharts, dependencies, pipelines
100%

Advertisement

Guide

About the Graphviz Viewer

Graphviz draws graphs from a short text description in the DOT language: you list the nodes and the edges between them, and a layout engine works out where everything goes. It is the tool behind many dependency graphs, call graphs, state diagrams and database schemas, and DOT is what many programs print when asked for a graph.

This viewer runs Graphviz itself in your browser, so a graph looks the same here as it does from the command line, and the DOT never leaves your computer.

Which layout engine to use

  • dot: layers with edges pointing one way. Use it for flowcharts, pipelines, dependency and call graphs. rankdir=LR draws left to right.
  • neato and fdp: springs between connected nodes, for undirected graphs such as networks. fdp also handles clusters.
  • sfdp: the force-directed engine for large graphs, from hundreds to many thousands of nodes.
  • circo: circles, for rings and cycles. twopi: rings around a centre node (set root=), for mind maps and trees.
  • osage packs clusters into a grid; patchwork draws a tree map, with areas from the area attribute.

DOT in one minute

  • digraph has arrows (a -> b); graph has lines (a -- b).
  • Attributes go in brackets: a [shape=box color=red label="Start"]. node [...] and edge [...] set defaults for what follows.
  • a -> {b c} draws edges from a to both b and c.
  • A subgraph cluster_name { … } draws a box around its nodes; {rank=same; a b} keeps nodes on one level.
  • label=<<table>…</table>> with shape=plain builds tables, such as database schemas.

How to use it

  1. 1Paste DOT, open a .dot or .gv file, or start from an example.
  2. 2Pick a layout engine if the graph does not set one with layout=.
  3. 3Drag to move around, Ctrl+wheel to zoom, double-click to fit.
  4. 4Save as SVG or PNG, or copy the SVG into a document or web page.

Frequently asked questions

Is this the real Graphviz?

Yes. It is Graphviz compiled from its C source to WebAssembly (the @hpcc-js/wasm-graphviz package), so the layouts, shapes and attributes are the ones the dot command uses.

Is my graph uploaded?

No. The layout runs in your browser. The DOT is kept in this browser’s storage so it is there when you come back; Reset removes it.

Why do nodes overlap with neato, sfdp or twopi on the command line but not here?

Those engines place nodes as points, so by default long labels end up on top of each other and edges run straight through nodes. With “Keep nodes apart” on (the default) the viewer adds overlap=false and splines=true, as -Goverlap=false -Gsplines=true would in a terminal. Settings in your own DOT still win; turn the option off to see Graphviz’s plain defaults.

Why did the layout engine I picked make no difference?

A layout= attribute in the graph wins over the engine chosen in the menu, as it does over the -K flag of the dot command. The page shows a note when that happens.

Why are links in my graph not clickable?

The preview is shown as an image, so a URL or href in the DOT cannot run anything or open a page while you edit. The links are kept in the SVG you save, apart from javascript: links, which are removed.

Why do images in my nodes not appear?

Graphviz in the browser cannot read files or fetch pictures from the web, so image= attributes draw an empty space. Add the pictures to the saved SVG afterwards, or use shapes and colours.

Which fonts are used?

Graphviz writes the font name into the SVG and your browser draws the text with that font, or a similar one if it is not installed. Helvetica or Arial gives the most predictable result across computers.