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

45 lines
No EOL
1.2 KiB
Text

digraph g {
l1 [label = "Enter f()"];
l2 [label = "2: int sum = 0"];
l3 [label = "3: int prod = 0"];
l4 [label = "4: while (x > 0)"];
l5 [label = "5: sum += sum"];
l6 [label = "6: prod *= prod"];
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 l3 l4 l9};
l1 -> l10 [color = black, style = bold];
l4 -> {l5 l6 l7};
}
{ // 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} -> {l6} [color = grey]; // prod
{l3 l6} -> {l10} [color = darkgreen, style = bold]; // prod
{x l7} -> {l4 l7} [color = grey]; // x
}
}