Reputation: 881
screenshot. I am looking for a graph on the right but what I am getting is a graph on the left. I am new to Graphviz. I also had to make the nodes 1 and 2 just because I was not able to imitate the image on the right. Also my shapes of terminals aren't exactly same. somebody help me with this. my code till now:
digraph M
{
style=filled;
graph [splines = headport];
START->1
1->"Is COUNT\nan even\nnumber?"
"Is COUNT\nan even\nnumber?"->"SUM = SUM +\nCOUNT" [label=TRUE]
"SUM = SUM +\nCOUNT"->2
"Is COUNT\nan even\nnumber?"->2 [label=FALSE]
2->"COUNT = COUNT+1"
"COUNT = COUNT+1"->"IS COUNT >\n20"
"IS COUNT >\n20"->1 [label=FALSE]
"IS COUNT >\n20"->STOP[label=TRUE]
"Is COUNT\nan even\nnumber?"[shape=diamond]
"SUM = SUM +\nCOUNT"[shape=rectangle]
"IS COUNT >\n20"[shape=diamond]
"COUNT = COUNT+1"[shape=rectangle]
1[shape=circle]
2[shape=circle]
START[shape=record, style="rounded"]
STOP[shape=record, style="rounded"]
}
Upvotes: 4
Views: 1149
Reputation: 7409
I made a few changes to your diagram to get you closer. Polylines for splines and changed the attributes of the 1 and 2 nodes to be a little closer to your goal. Clearly not perfect but hopefully better enough to help and suggest other ways you might improve it further without major redesign.
digraph M
{
style=filled;
graph [splines = headport splines=polyline];
START->1
1->"Is COUNT\nan even\nnumber?"
"Is COUNT\nan even\nnumber?"->"SUM = SUM +\nCOUNT" [label=TRUE]
"SUM = SUM +\nCOUNT"->2
"Is COUNT\nan even\nnumber?"->2 [label=FALSE]
2->"COUNT = COUNT+1"
"COUNT = COUNT+1"->"IS COUNT >\n20"
"IS COUNT >\n20"->1 [label=FALSE tailport=e]
"IS COUNT >\n20"->STOP[label=TRUE ]
"Is COUNT\nan even\nnumber?"[shape=diamond]
"SUM = SUM +\nCOUNT"[shape=rectangle]
"IS COUNT >\n20"[shape=diamond]
"COUNT = COUNT+1"[shape=rectangle headport=n]
1[shape=point size="0,0" label=""]
2[shape=point size="0,0" label=""]
START[shape=record, style="rounded"]
STOP[shape=record, style="rounded"]
}
Upvotes: 1