# Latency in loading graph

**URL:** <https://forum.graphviz.org/t/latency-in-loading-graph/727>\
**Category:** Help\
**Created:** [June 29, 2021, 6:33pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727 "2021-06-29T18:33:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mamta](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@mamta](https://forum.graphviz.org/u/mamta)\
**Post date:** [June 29, 2021, 6:33pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/1 "2021-06-29T18:33:46Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 29, 2021, 8:15pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/2 "2021-06-29T20:15:21Z")

</div>

- 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?

---

<div class="post-metadata">

**Author:** ![erg](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/erg/32/34_2.png) [@erg](https://forum.graphviz.org/u/erg)\
**Post date:** [June 30, 2021, 9:02pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/3 "2021-06-30T21:02:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mamta](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@mamta](https://forum.graphviz.org/u/mamta)\
**Post date:** [July 1, 2021, 3:46am UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/4 "2021-07-01T03:46:54Z")

</div>

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”)]

---

<div class="post-metadata">

**Author:** ![mamta](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@mamta](https://forum.graphviz.org/u/mamta)\
**Post date:** [July 1, 2021, 4:08am UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/5 "2021-07-01T04:08:01Z")

</div>

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”];  
“sm”;  
“csm”;  
“gs”;  
“hrs”;  
“id”;  
“ms”;  
“psm”;  
“sm”;  
“ss”;  
}

subgraph cluster\_B {  
graph [label = “B”, style = “filled”, color = “lightgrey”, rank =same];  
node [style = “filled”, color = “white”];  
“cs”;  
“chs”;  
“cps”;  
“css”;  
“cws”;  
…  
}

…  
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 ?

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [July 1, 2021, 2:58pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/6 "2021-07-01T14:58:42Z")

</div>

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

````auto
```dot
digraph {
  like -> so[with="a label"];
}
```

````

which produces:

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

```

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [July 1, 2021, 4:19pm UTC](https://forum.graphviz.org/t/latency-in-loading-graph/727/7 "2021-07-01T16:19:51Z")

</div>

From [https://www.graphviz.org/pdf/dotguide.pdf:](https://www.graphviz.org/pdf/dotguide.pdf:)

> 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](https://forum.graphviz.org/t/where-does-generating-the-graph-take-most-of-the-time/668/2) 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.
