'How can I create a table like this with Graphviz (Table with arrow connecting rows)

I need to make a table with arrows pointing from one row to another.

On the left hand side, the arrows are pointing from the top to bottom and vice versa on the right hand side.

This table will be used for documentation and my plan is to generate the .dot file programmatically using python. The original table in the diagram below was generated using Latex, but the server which will be running this flow does not have any pdf-latex converters installed.

Original Table (With Latex)

I tried the sample code below on graphic but its not giving the desired output.

digraph {
    graph [pad="0.5", nodesep="0.5", ranksep="2", splines="ortho"];
    node [shape=plain]
    rankdir=LR;


Foo [label=<
<table border="0" cellborder="1" cellspacing="0">
  <tr>  <td><i>Input Foo</i></td> <td> two </td>   </tr>
  <tr>  <td port="1">one</td> <td> two </td></tr>
  <tr>  <td port="2">two</td> <td> two </td></tr>
  <tr>  <td port="3">three</td> <td> two </td></tr>
  <tr>  <td port="4">four</td> <td> two </td></tr>
  <tr>  <td port="5">five</td> <td> two </td></tr>
  <tr>  <td port="6">six</td> <td> two </td></tr>
</table>>];



Foo:3 -> Foo:2;
Foo:3 -> Foo:6;
Foo:6 -> Foo:1;

}

Failed graphviz attempt



Solution 1:[1]

Congratulations, you found a bug in the "ortho" implementation.
If you remove the splines attribute, or change the value, you will get edges to-from the correct ports.
If you then add directional ports (n, s, e, w, ...) the edge connections make sense.
But the edges will be loops, not the squared-off edges you desire. (see below).
It might be possible to "roll-your-own" edges using straight lines and two invisible points for each edge. But that would be a double hassle since a table is involved.
You could also output to the "dot" format, post-process that to create squared-off edges, and then run that through neato -n2, but again some real hassle.

digraph {
  graph [pad="0.5", nodesep="0.5", ranksep="2" ]  //  splines=ortho]
  node  [shape=plain]
 // rankdir=LR;  // makes a very small difference

Foo [label=<
<table border="0" cellborder="1" cellspacing="0">
  <tr>  <td><i>Input Foo</i></td><td> two </td>   </tr>
  <tr>  <td port="1">one</td><td> two </td></tr>
  <tr>  <td port="2">two</td><td> two </td></tr>
  <tr>  <td port="3">three</td><td> two </td></tr>
  <tr>  <td port="4">four</td><td> two </td></tr>
  <tr>  <td port="5">five</td><td> two </td></tr>
  <tr>  <td port="6">six</td><td> two </td></tr>
</table>>];

Foo:3:w -> Foo:2:w;
Foo:3:w -> Foo:6:w;
Foo:6:w -> Foo:1:w;
}

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sroush