I have two graphs being rendered by dot:
graph G {
graph[rankdir=LR]
node[shape=circle, fontname="Courier-Bold", fontsize=10, width=0.4, height=0.4, fixedsize=true]
edge[arrowsize=0.6, fontname="Courier-Bold", fontsize=10, arrowhead=vee]
v0 -- i0 [label=11]
v1 -- i0 [label=2]
v2 -- i0 [label=10]
i0 -- i1 [label=4]
i1 -- i2 [label=3]
i2 -- v3 [label=3]
i2 -- v4 [label=4]
i1 -- v5 [label=0, style=dashed]
}
graph G {
graph[rankdir=LR]
node[shape=circle, fontname="Courier-Bold", fontsize=10, width=0.4, height=0.4, fixedsize=true]
edge[arrowsize=0.6, fontname="Courier-Bold", fontsize=10, arrowhead=vee]
subgraph cluster_two {
fontname="Courier-Bold"
fontsize=10
v0 -- i0 [label=11]
v1 -- i0 [label=2]
v2 -- i0 [label=10]
i0 -- i1 [label=4]
i1 -- i2 [label=3]
i2 -- v3 [label=3]
i2 -- v4 [label=4]
i1 -- v5 [label=0, style=dashed]
}
}
The 2nd graph is exactly the same as the first, except that it's wrapped in subgraph. For whatever reason, the subgraph wrapping makes it so that node separation is much wider than normal:
The nodesep attribute doesn't control the nodes under a subgraph. Is there anything to get node placement to unstretch back to normal (as in the 1st picture)?
Ranksep is the attribute that sets the distance from one rank to the next. Ranksep is a graph-level attribute. When it is set, it applies to the entire graph. This is also true for nodesep, except nodesep sets the distance between two adjacent nodes on the same rank.
p.s. 2.40.1 is a rather old release. Many fixes have been applied over the last 18 months or so (I take no credit).