如何在graphviz中定义节点形状?

时间:2012-07-02 17:27:45

标签: graphviz dot

我想绘制圆圈作为点中的节点。我正在使用以下简单的代码,它应该绘制圆圈。但它吸引了日食。这是我的代码:

digraph G {
node [ shape=circle, width=0.5, height = 0.5, fixedsize=true]
Node1  -> Node1 ;
Node1 -> Node2;
Node2 -> Node1;
Node2 -> Node2;
};

这就是我得到的:

enter image description here

如何绘制圆圈?

3 个答案:

答案 0 :(得分:2)

您的文件中的所有内容都绝对正确。必须有圈子。

image

答案 1 :(得分:1)

使用shape="circle"应该有效,例如:

digraph G {
0 [color="aqua", label="A", shape="circle", style="filled"];
1 [color="bisque", label="B", shape="circle", style="filled"];
2 [color="blue", label="C", shape="circle", style="filled"];
3 [color="blueviolet", label="E", shape="circle", style="filled"];
4 [color="brown", label="D", shape="circle", style="filled"];
5 [color="burlywood", label="F", shape="circle", style="filled"];
6 [color="cadetblue", label="G", shape="circle", style="filled"];
0->0 ;
0->1;
1->4;
2->2;
2->3;
3->4;
4->4;
4->5;
4->6;
5->0;
6->2;
}

enter image description here

答案 2 :(得分:0)

digraph G {
node [ shape="circle", width=1, height = 1, fixedsize=true];
s0 -> s0 [label="a -> x = x.a\ny = y.a"];
s0 -> s1 [label="a -> x = x.a\ny = y.a"];
s1 -> s0 [label="a -> x = x.a\ny = y.a"];
s1 -> s1 [label="a -> x = x.a\ny = y.a"];
};

输出是:

enter image description here

有更好的渲染方式吗?