tfm-slides/figs/example-slice-4.dot
2019-12-15 15:32:54 +01:00

46 lines
No EOL
1.3 KiB
Text

digraph g {
l1 [label = "Enter f()", style = filled];
l2 [label = "2: int sum = 0"];
l3 [label = "3: int prod = 0", style = filled];
l4 [label = "4: while (x > 0)"];
l5 [label = "5: sum += sum"];
l6 [label = "6: prod *= prod", style = filled];
l7 [label = "7: x--"];
l9 [label = "9: log(\"sum: \" + sum)"];
l10 [label = "10: log(\"prod: \" + prod)", style = "bold,filled"];
// graph order
{rank=min; l1};
{rank=same; l2 l3 l4 l9 l10};
{rank=max; l5 l6 l7};
{ edge [style=invis];
l2 -> l3 -> l4 -> l9 -> l10;
l5 -> l6 -> l7;
}
{ // control edges
// edge [style=invis];
edge [color = grey];
l1 -> {l2 l4 l9 l10};
l1 -> l3 [color = black];
l4 -> {l5 l7};
l4 -> l6 [style = bold, color = black];
}
{ // data input
node [style=dashed];
edge [color = grey];
// node [style=invis];
// edge [style=invis];
x [label = "x = x_in"];
l1 -> x;
x -> {l2} [style=invis];
}
{ // data edges
edge [color=red,constraint=true];
{l2 l5} -> {l5 l9} [color = grey]; // sum
{l3 l6} -> {l10} [color = grey]; // prod
{l3 l6} -> l6 [color = darkgreen];
{x l7} -> {l4 l7} [color = grey]; // x
}
}