user1280282
user1280282

Reputation: 303

How to define a node shape in graphviz?

I want to draw circle as the node in dot. I am using the following simple code which should draw circle. But it draws draws eclipse instead. This is my code :

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

This is what I get :

enter image description here

How do I draw circle?

Upvotes: 1

Views: 6626

Answers (3)

user1280282
user1280282

Reputation: 303

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"];
};

Output is :

enter image description here

Any better way of rendering it?

Upvotes: 0

Dan
Dan

Reputation: 1486

Using shape="circle" should work, for example:

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

Upvotes: 1

Igor Chubin
Igor Chubin

Reputation: 64613

All is absolutely correct in your file. There must be circles.

image

Upvotes: 2

Related Questions