Search code examples
svggraphviz

Graphviz - multiple links for each section of the record


I know that this can be done with the HTML label instead of the record label, but I want to see if this is possible with the record shape for its simplicity for the rest of the graph.

I have this for example:

struct1 [label="{<f0> link1|{<f1> link 2 |<f2> link 3}}", URL="[https://sampleurl.com]"];

All three, sections of the record go to the same link. How do I assign each of them a separate link.


Solution

  • From the "shapes" documentation (https://graphviz.gitlab.io/doc/info/shapes.html - a little hard to find) creates a port named xyz:

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