Table structure in graphviz

49 Views Asked by At

Is it possible to create a figure with dot where nodes are organized into a "strict" table structure as seen on below figure? In this example, each node belongs to a certain column, i.e. nodes with same function or label. Vertical spacing between each node is identical.

enter image description here

I have tried to use the structure but cannot include nodes within the table.

1

There are 1 best solutions below

2
sroush On BEST ANSWER

Here is one way - explicitly set the X & Y positions of all the nodes (see https://graphviz.org/faq/#FaqDotWithNodeCoords ).
If you are a programmer, this should be rather easy. The example below was done manually.

digraph RC {
  node [shape=rect label="" pin=true]
  A [pos="1,7"]
  B [pos="2,6"]
  C [pos="1,5"]
  D [pos="2,4"]
  E [pos="3,3"]
  F [pos="1,2"]
  G [pos="2,1"]
 
  A->B->C->D->E->F->G

  node [width=5]  // inches
  t1[label=" some text goes here"  pos="7,7"]
  t2[label=" some more text goes here"  pos="7,6"]
  t3[label=" even more text goes here"  pos="7,5"]
  t4[label=" some text goes here"  pos="7,4"]
  t5[label=" some text goes here"  pos="7,3"]
  t6[label=" some text goes here"  pos="7,2"]
  t7[label=" last text goes here"  pos="7,1"]
} 

Giving:
enter image description here