digraph {
rankdir=LR;
0 [ shape = doublecircle, label = "0 \n generate=5" ];
1 [ shape = doublecircle, label = "1 \n generate=2" ];
3 [ shape = rect, label = "3 \n consume=2" ];
4 [ shape = rect, label = "4 \n consume=1" ];
5 [ shape = rect, label = "5 \n consume=4" ];
0 -> 0 [ label = "1" ];
0 -> 1 [ label = "2" ];
0 -> 2 [ label = "5" ];
1 -> 0 [ label = "1" ];
1 -> 2 [ label = "8" ];
2 -> 3 [ label = "1" ];
2 -> 4 [ label = "7" ];
3 -> 5 [ label = "2" ];
3 -> 6 [ label = "5" ];
4 -> 2 [ label = "7" ];
4 -> 3 [ label = "5" ];
4 -> 5 [ label = "1" ];
6 -> 0 [ label = "5" ];
}
$ dot -Tpng sample.dot -o sample.png