The documentation on attributes contains a note, linked to from various other attribute docs (like taillabel
and headport
) as “the limitation”:
Note: Some attributes, such as
dir
orarrowtail
, are ambiguous when used in DOT with an undirected graph since the head and tail of an edge are meaningless. As a convention, the first time an undirected edge appears, the DOT parser will assign the left node as the tail node and the right node as the head. For example, the edgeA -- B
will have tailA
and headB
. It is the user’s responsibility to handle such edges consistently. If the edge appears later, in the formatgraph { B -- A [taillabel = "tail"] }
the drawing will attach the tail label to node
A
. To avoid possible confusion when such attributes are required, the user is encouraged to use a directed graph. If it is important to make the graph appear undirected, this can be done using thedir
,arrowtail
orarrowhead
attributes.
That note has been there since the graphviz sources were first checked in 19 years ago.
Except, I can’t seem to make the problem actually happen. I’ve tried every renderer available in the Visual Editor (except patchwork because that doesn’t draw edges), and every one of them always puts the tail label on the left-hand edge argument, and the head label on the right-hand edge argument. For example, this code:
graph {
edge [taillabel=<<font color="purple">t↓</font>> color=purple]
A -- B -- C
B -- A [taillabel = <<font color="brown">B↑</font>> color=brown]
C -- B [taillabel = <<font color="green">C↑</font>> color=green]
B -- C [taillabel = <<font color="red">B↓</font>> color=red]
A -- B [taillabel = <<font color="orange">A↓</font>> color=orange]
edge [taillabel="" color=default headport=e]
D -- E -- F [taillabel="T↓" headlabel="H↓"]
E:n -- D [headlabel=<<font color="grey">head↑</font>> color=grey tailport= n headport=s]
}
is rendered by dot
as:
All of the labels are on the correct ends of their respective edges, and all of the port assignments match up as well. So, under what conditions will this reversed interpretation actually occur? Or is it no longer a valid limitation?