diagraph icon indicating copy to clipboard operation
diagraph copied to clipboard

Record-based nodes support

Open RatCornu opened this issue 1 year ago • 2 comments

Hello! While trying to render a graph like this one:

digraph structs {
    node [shape=record];
    struct1 [label="<f0> left|<f1> mid\ dle|<f2> right"];
    struct2 [label="<f0> one|<f1> two"];
    struct3 [label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"];
    struct1:f1 -> struct2:f0;
    struct1:f2 -> struct3:here;
}

I saw that currently record-based nodes are not supported by diagraph. I think it would be great to add this feature!

RatCornu avatar Jun 29 '24 18:06 RatCornu

Hello, I will try to do something for the next version

Robotechnic avatar Nov 11 '24 21:11 Robotechnic

Hello! While trying to render a graph like this one:

digraph structs { node [shape=record]; struct1 [label=" left| mid\ dle| right"]; struct2 [label=" one| two"]; struct3 [label="hello\nworld |{ b |{c| d|e}| f}| g | h"]; struct1:f1 -> struct2:f0; struct1:f2 -> struct3:here; }

I saw that currently record-based nodes are not supported by diagraph. I think it would be great to add this feature!

Hi, that's really less readable, but you can do record-like node with table :

digraph {
  struct1 [shape=plaintext; label=<<table cellspacing="0" cellborder="1" border="0"><tr><td>left</td><td port="f1">mid dle</td><td port="f2">right</td></tr></table>>]
  struct2 [shape=plaintext; label=<<table cellspacing="0" cellborder="1" border="0"><tr><td port="f0">one</td><td>two</td></tr></table>>]
  struct3 [shape=plaintext; label=<<table cellspacing="0" cellborder="1" border="0"><tr><td rowspan="3">hello<br/>world</td><td colspan="3">b</td><td rowspan="3">g</td><td rowspan="3">h</td></tr>
  <tr><td>c</td><td port="here">d</td><td>e</td></tr>
  <tr><td colspan="3">f</td></tr>
  </table>>]

  struct1:f1 -> struct2:f0;
  struct1:f2 -> struct3:here;  
}

Coethium avatar Jun 16 '25 19:06 Coethium