Latency in loading graph

I have a graph where there are > 600 edges, and the load time of this graph is 30s , how can I decrease this latency, are there any optimizations which I could do at code level to decrease this latency, also does Graphviz supports collapse feature at cluster/node levels ?

  • It will be easier to help you if you can share your input file.
  • Also, what OS are you using (Linux Windows, Apple), what version of Graphviz (type dot -V), and which layout engine you are using (dot, fdp, neato, …)
  • There are some tuning attributes. Most are specific to a particular layout engine.
  • Please say more about a “collapse feature”. Is this a feature that the end-user would be able to invoke while they looked at the resulting graph?

Also, what do you mean by “load time”? Are you using a graph viewer?

OS Version
NAME=“Ubuntu” VERSION=“16.04.4 LTS (Xenial Xerus)”

Graphviz Version
2.38.0 (20140413.2041)

layout engine dot.
I am basically using npm package of graphviz in my node application to renderGraph.
By load time I mean to output the g into svg. [g.output(“svg”)]

My dot_file is something like this[names changed]:
digraph G {
graph [ rankdir =TB, compound =true, splines = “ortho” ];
node [ shape =rectangle ];
subgraph cluster_A {
graph [ label = “A”, style = “filled”, color = “peachpuff”, rank =same ];
node [ style = “filled”, color = “white” ];

subgraph cluster_B {
graph [ label = “B”, style = “filled”, color = “lightgrey”, rank =same ];
node [ style = “filled”, color = “white” ];


there are total 8 clusters and 96 nodes and 600 edges.

One thing I noticed here was when I horizontally aligned all clusters the load time decreased significantly but that reduces the readability of this graph, hence wanted to know if we can achieve both by tweaking some config ?

PSA: the forum supports code blocks with Graphviz syntax highlighting:

digraph {
  like -> so[with="a label"];

which produces:

digraph {
  like -> so[with="a label"];


dot also provides access to various parameters which play technical roles in the layout algorithms. These include mclimit, nslimit, nslimit1, remincross and searchsize.

Where does generating the graph take most of the time? - #2 by smattr sheds some information on dot tuning (stackoverflow might have more)

Two specific things:

  • you are using a 7 year-old version of Graphviz. That probably isn’t helping.
  • you might try changing your splines setting. Ortho is somewhat problematic.

If you upload your source, we might be able to give more specific guidance.