Creating a DOT graph with thousands of nodes

Hi,

Very new to Graphviz so apologies if this is a silly question.

I’m trying to produce a DOT graph similar to the decision tree shown here. The graph works perfectly for small test cases. However, when I try to build the full graph (which has 14,453 nodes and 21,669 edges), the application exits without producing a graph.

Command switch: dot -Tsvg doddle_dot_file.vg -o graph1.svg

I’m aware this is a huge amount of nodes and I’m almost certain it’s hitting memory issues. Just wondering if there is any way around this (i.e. if my DOT code is inefficient, if there is a better way or if I can up the memory usage). It works for 5,800 nodes but stops working above 6,100.

Thanks! Here is a minimal reproduction of my DOT code:

digraph G {
	graph [dpi=50 rankdir=LR splines=ortho]
	node [fontname="Courier New" shape=plaintext]
	edge [arrowhead=vee color=cadetblue splines=true]
	g1 [label=CRATE]
	02011 [label="⬜🟩⬜🟨🟨"]
	g1 -> 02011
	"02011-g2" [label=TRUER]
	02011 -> "02011-g2"
	"02011-12210" [label="🟨🟩🟩🟨⬜"]
	"02011-g2" -> "02011-12210"
	"02011-12210-g3" [label=ERUPT]
	"02011-12210" -> "02011-12210-g3"
	"02011-12210-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-12210-g3" -> "02011-12210-22222"
	"02011-12020" [label="🟨🟩⬜🟩⬜"]
	"02011-g2" -> "02011-12020"
	"02011-12020-g3" [label=GREET]
	"02011-12020" -> "02011-12020-g3"
	"02011-12020-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-12020-g3" -> "02011-12020-22222"
	"02011-22010" [label="🟩🟩⬜🟨⬜"]
	"02011-g2" -> "02011-22010"
	"02011-22010-g3" [label=TREND]
	"02011-22010" -> "02011-22010-g3"
	"02011-22010-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-22010-g3" -> "02011-22010-22222"
	"02011-22020" [label="🟩🟩⬜🟩⬜"]
	"02011-g2" -> "02011-22020"
	"02011-22020-g3" [label=TRIED]
	"02011-22020" -> "02011-22020-g3"
	"02011-22020-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-22020-g3" -> "02011-22020-22222"
	"02011-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-g2" -> "02011-22222"
	"02011-12010" [label="🟨🟩⬜🟨⬜"]
	"02011-g2" -> "02011-12010"
	"02011-12010-g3" [label=WREST]
	"02011-12010" -> "02011-12010-g3"
	"02011-12010-22222" [label="🟩🟩🟩🟩🟩"]
	"02011-12010-g3" -> "02011-12010-22222"
}

That is a lot of nodes, but not that many edges, so maybe you can get a graph - though it might need “too much” real-estate to display.
Suggestions:

1 Like

Amazing. Removing othro worked. Thank you so much - I really, really appreciate it!

I’d spent ages building graph functionality into my pet project and was kinda down that they wouldn’t render. This has made my day! :grin: