Search code examples
graphvizdot

Graphviz - how to constrain edges to only connecting to east or west faces of a node?


I am pretty new to Graphviz and needing to try to constrain connections to only the left or right (or east or west) faces of a node. So far my DOT scripting efforts result in the output shown in attached image.

Any suggestions most appreciated.

enter image description here


Solution

  • Using ports (https://www.graphviz.org/doc/info/attrs.html#k:portPos) will probably solve this problem.

    digraph i{
      t [shape=plaintext,label=<
      <TABLE CELLSPACING="2" CELLPADDING="2" BORDER="1">
      <TR><TD PORT="one_l">one left</TD><TD PORT="one_r">one right</TD></TR>
      <TR><TD PORT="l2">one left</TD><TD PORT="xyz">one right</TD></TR>
      </TABLE>
      >
      ]
      x -> t:one_l:w
      t:xyz:e -> XX
    } 
    

    Giving:
    enter image description here