I'm using the ruby-graphviz gem and I'm trying to draw binary trees. I'd like to use the record shape so that each node can have a left, middle, and right field and, thus, if there are two edges leaving a node, the left and right edges can be distinguished.

I tried specifying the field by concatenating the field name like this: @node1.name + ":left" But that did not work. What is the correct way of specifying the field?

in the GraphViz documentation, you can see that a node ID must not begin with a digit. So if you change your code and replace the two nodes names (1 and 2) by any other ID beginning by a letter or an underscore, it works :