2

我很想去: 在此处输入图像描述

我尝试了这样的图表的变化:

digraph G {
    node [shape=circle penwidth=2 fixedsize=true label=""]
    token [shape=point ]
    place [ xlabel="P2" _background="digraph G { e[shape=point ] }"]
}

可在此在线表格中进行测试,结果是:

在此处输入图像描述

我应该怎么做才能将点 ( token) 放在圆圈 ( place)内

4

2 回答 2

0

Albert 的想法(使用 unicode 符号)效果很好(使用点大小来改变点大小):

digraph G {
    node [shape=circle penwidth=2  label=""]
    n1 [ xlabel="P1" label=<<font point-size="8">&#9899;</font>>]
    n2 [ xlabel="P2" ]
    n3 [ xlabel="P3" label=<<font point-size="6">&#9899;</font>>]
  
    n1 -> n2
    n1 -> n3
    n2 -> n3
}

给出了这个: 在此处输入图像描述

于 2020-06-28T19:38:40.567 回答
0

Graphviz 程序通常不喜欢故意将节点放置在其他节点之上,但在特殊情况下允许这样做——neato -nneato -n2允许这样做(参见常见问题解答)。 在此处输入图像描述

我在这个输入文件中添加了一个新属性(dotme):

digraph G {
    node [shape=circle penwidth=2  label=""]
    n1 [ xlabel="P1" dotme=1]
    n2 [ xlabel="P2" ]
    n3 [ xlabel="P3" dotme=1]
  
    n1 -> n2
    n1 -> n3
    n2 -> n3
}

然后通过这组 Graphviz 程序运行它:

dot -Tdot needsadot.gv |gvpr -c -fdotMe.gvpr |neato -n2 -Tpng >needsadot.png

gvpr 程序 dotMe.gvpr 在这里:

BEGIN {

  int nxt=0;

}
N {
  int i;
  string str1, str2;
  node_t n;

  if (hasAttr($, "dotme")){
    if (strcmp($.dotme,"1")==0){
      // create a new node and position it on top of existing node
      str1=sprintf("__dot_%d", ++nxt);
      n=node($G, str1);
      n.pos=$.pos;
      n.shape="point";
    }
  }
}

dotMe.gvpr在 dotme==1 的每个节点上(相同的pos )添加一个新节点。
令人费解,但可重复使用。

于 2020-06-27T21:20:40.593 回答