Graphviz: How can I create edges between cells in an HTML table?

Pay attention to the following code:

digraph G { node [shape=plaintext] a [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD ID="first" BGCOLOR="gray">first</TD></TR> <TR><TD ID="second" PORT="f1">second</TD></TR> <TR><TD ID="third" PORT="f2">third</TD></TR> </TABLE>>]; b [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD ID="first" BGCOLOR="gray">first</TD></TR> <TR><TD ID="second" PORT="f1">second</TD></TR> <TR><TD ID="third" PORT="f2">third</TD></TR> </TABLE>>]; a:first -> b:first; } 

I get a ton of warnings:

 laci@nitehawk ~ $ dot records.gv -T pdf > records.pdf Warning: Illegal attribute ID in <TD> - ignored Warning: Illegal attribute ID in <TD> - ignored Warning: Illegal attribute ID in <TD> - ignored in label of node a Warning: Illegal attribute ID in <TD> - ignored Warning: Illegal attribute ID in <TD> - ignored Warning: Illegal attribute ID in <TD> - ignored in label of node b Warning: node a, port first unrecognized Warning: node b, port first unrecognized 
+4
source share
2 answers

You can simply use PORT instead of ID , and then use the edge definition, as in your example.

 <TD PORT="first" BGCOLOR="gray">first</TD> 

ID The goal is to use in a downstream, so if you are not using SVG output and reusing the identifier elsewhere, they are probably not very useful.

As for the warnings, I am not getting them with graphviz 2.28. If you are using an earlier version of graphviz, I suggest updating.

graphviz html label ports

+8
source

For completeness, the full source that really works is used here:

 digraph G { node [shape=plaintext] a [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD PORT="c" BGCOLOR="gray">first</TD></TR> <TR><TD PORT="d">second</TD></TR> <TR><TD PORT="e">third</TD></TR> </TABLE>>]; b [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD PORT="c" BGCOLOR="gray">first</TD></TR> <TR><TD PORT="d">second</TD></TR> <TR><TD PORT="e">third</TD></TR> </TABLE>>]; a:c -> b:c; } 
+8
source

Source: https://habr.com/ru/post/1445886/


All Articles