Allign node's stroke with end of the arrow's path width

Hi all,

When you have graphs with a significant edgewidth.

for instance:

digraph {
    A -> B [penwidth=10]
}

Capture

It seems like the fill of the arrow-head aligns with the fill of the nodes shape, i.e. the stroke or border of the arrow overlaps significantly with the node…

Is there a way to counteract this behavior, e.g. using a do-not-overlap setting or manually adding an offset between the arrowhead and the node.

Yep, looks like a bug to me. You get the same result with png and svg. I’m surprised this hasn’t been reported before.
The only work-around I found was this:

  1. dot -T dot yourfile.gv >yourfile.dot
  2. edit all the pos values for edges with penwidth>1 (see Attributes | Graphviz and example below)
  3. neato -n2 -Tpng youreditedfile.dot >yourfile.png

(See also the FAQ - FAQ | Graphviz)

Like so:

digraph {
	graph [bb="0,0,54,108"];
	node [label="\N"];
	A	[height=0.5,
		pos="27,90",
		width=0.75];
	B	[height=0.5,
		pos="27,18",
		width=0.75];
	A -> B	[penwidth=10,
		 //pos="e,27,36.104 27,71.697 27,63.983 27,54.712 27,46.112"];
	pos="e,27,44.104 27,71.697 27,63.983 27,54.712 27,46.112"];
}

Giving:
fatEdge0

Well I’ve known about the bug for almost two years. But I just put up with it since I saw no alternatives… I only recently was pointed to the forums

Note that this happens to me even with the most simple of graphs, with the default settings. E.g. see this graph and its PDF output.

digraph {
    a -> b;
}

I personally find it a real eye sore. Another eye sore is that the label of a vertically straight edge touches the edge. Both problems visible in the image below.

Hi, starting to work on my slides for teaching graph theory. I was really happy to work with Graphviz for one day until I started creating my first directed graph…

Thus bug is really a no-go for me. I use penwidth=1.75 for the edges and the nodes, nothing too much for slides.

Is there really nothing new about that bug?

Sorry it is a no-go. The issue is being worked. Here is a link to the issue: ([Output Generation] Failure of arrowhead and arrowtail to respect penwidth (#372) · Issues · graphviz / graphviz · GitLab)

Since I work with EPS output, I manually edited the resulting file and noticed I could get acceptable display by leaving 1.75 setlinewidth for the edge (as initially wanted) but setting something like 0.5 setlinewidth for the arrow.

Wouldn’t it be possible to add a new attribute for EPS (and maybe SVG) in order to get two different penwidth (one for the edge and one for the arrow)?

This does not solve your problem, but setlinewidth is deprecated, (see style | Graphviz and penwidth | Graphviz)

The setlinewidth style value can be used for more control over the width of node borders and  
edges than is allowed by bold. This style value takes an argument, specifying the width of the  
line in points. For example, style="bold" is equivalent to style="setlinewidth(2)". The use of  
setlinewidth is deprecated; one should use the penwidth attribute instead.

It looks like @magjac has made major improvements to this bug (see below).
What version of Graphviz are you using - dot -V. Maybe time to download a new version.

Old result:
edgeWidthTest0.old

New result:
edgeWidthTest0

1 Like

@steveroush Indeed, my version was very old. Just compiled the last version and it works now. Thank you.