Graphviz:如何在HTML表格单元格之间创建边缘?

Lás*_*nda 5 graphviz

请考虑以下代码:

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;
}
Run Code Online (Sandbox Code Playgroud)

我得到了相当多的警告:

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
Run Code Online (Sandbox Code Playgroud)
  1. 根据文件,TD的ID属性应该是合法的.我错过了什么?
  2. 如何引用单个单元格并在它们之间创建边缘?

Lás*_*nda 9

为了完整起见,这里是实际工作的完整来源:

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;
}
Run Code Online (Sandbox Code Playgroud)


mar*_*pet 8

您可以简单地使用PORT而不是ID像示例中那样使用边缘定义.

<TD PORT="first" BGCOLOR="gray">first</TD>
Run Code Online (Sandbox Code Playgroud)

ID的目的是下游使用,所以除非你使用SVG输出并在其他地方重用id,否则它们可能并不真正有用.

关于警告,我没有使用graphviz 2.28.如果你使用旧版本的graphviz,我建议你更新.

graphviz html标签端口