# Is the "undir\_note" (the limitation on head/tail assignments in undirected graphs) still accurate/

**URL:** <https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261>\
**Category:** Dev\
**Created:** [June 15, 2024, 2:03pm UTC](https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261 "2024-06-15T14:03:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeRDNYC](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/ferdnyc/32/1428_2.png) [@FeRDNYC](https://forum.graphviz.org/u/FeRDNYC)\
**Post date:** [June 15, 2024, 2:03pm UTC](https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261/1 "2024-06-15T14:03:15Z")

</div>

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` or `arrowtail`, 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 edge `A -- B` will have tail `A` and head `B` . It is the user’s responsibility to handle such edges consistently. If the edge appears later, in the format
> 
> ```dot
> graph {
> 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 the `dir`, `arrowtail` or `arrowhead` 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:

```dot
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:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/0/04b6037ba7f27c331d20a91029e4856d0f788cd1.png)

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?

---

<div class="post-metadata">

**Author:** ![FeRDNYC](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/ferdnyc/32/1428_2.png) [@FeRDNYC](https://forum.graphviz.org/u/FeRDNYC)\
**Post date:** [June 15, 2024, 2:03pm UTC](https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261/2 "2024-06-15T14:03:57Z")

</div>

(Also, I was just prevented by Discourse from posting a link to _the graphviz documentation_, which is completely insane.)

---

<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 15, 2024, 11:36pm UTC](https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261/3 "2024-06-15T23:36:53Z")

</div>

Indeed. Here is my minimal test:

```auto
graph {
  edge [len=3.5 minlen=3]
  A -- B 
  B -- A [taillabel = "tail"]
}

```

And the results for multiple engines:

 ![HeadsAndTails.montage](https://global.discourse-cdn.com/graphviz/original/2X/8/804f25392eb29f081593ef4f6b2b8f4860bd655f.png)

If you think it is a documentation bug: [Issues · graphviz / graphviz.gitlab.io · GitLab](https://gitlab.com/graphviz/graphviz.gitlab.io/-/issues/?sort=updated_desc&state=opened&first_page_size=100)  
If you think it is a s/w bug: [Issues · graphviz / graphviz · GitLab](https://gitlab.com/graphviz/graphviz/-/issues/)

(I like spam on pizza, but that is a personal thing)

---

<div class="post-metadata">

**Author:** ![FeRDNYC](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/ferdnyc/32/1428_2.png) [@FeRDNYC](https://forum.graphviz.org/u/FeRDNYC)\
**Post date:** [June 18, 2024, 8:10am UTC](https://forum.graphviz.org/t/is-the-undir-note-the-limitation-on-head-tail-assignments-in-undirected-graphs-still-accurate/2261/4 "2024-06-18T08:10:44Z")

</div>

Reported as [documentation bug #318](https://gitlab.com/graphviz/graphviz.gitlab.io/-/issues/318).
