29 lines
No EOL
800 B
Text
29 lines
No EOL
800 B
Text
digraph g {
|
|
"f()" [shape=box, rank=min, style = filled];
|
|
// Rank adjustment
|
|
{ node []; // [style=filled]
|
|
{ rank = same; "int a = 1" [style = filled]; "while (a > 0)"; }
|
|
"if (a > 10)";
|
|
break [style = invis];
|
|
}
|
|
{ rank = same; "log(a)"; "a++"; }
|
|
{ rank = max; "a++"; "log(a)"; }
|
|
"a++" [style="bold,filled"];
|
|
// Control flow
|
|
"f()" -> "while (a > 0)";
|
|
"f()" -> "int a = 1";
|
|
"while (a > 0)" -> "if (a > 10)";
|
|
"if (a > 10)" -> "break";
|
|
break -> {"log(a)" "a++" "while (a > 0)"} [color = grey]
|
|
// Data flow
|
|
{ edge [color = red];
|
|
"int a = 1" -> "while (a > 0)";
|
|
"int a = 1" -> "if (a > 10)";
|
|
"int a = 1" -> "log(a)";
|
|
"int a = 1" -> "a++";
|
|
"a++" -> "a++";
|
|
"a++" -> "while (a > 0)";
|
|
"a++" -> "if (a > 10)";
|
|
"a++" -> "log(a)" [constraint = true];
|
|
}
|
|
} |