2019-12-14 15:27:01 +01:00
|
|
|
digraph g {
|
|
|
|
"f()" [shape=box, rank=min, style = filled];
|
|
|
|
// Rank adjustment
|
|
|
|
{ node [style=filled]
|
|
|
|
{ rank = same; "int a = 1"; "while (a > 0)"; }
|
|
|
|
"if (a > 10)"; break;
|
|
|
|
}
|
2019-12-19 13:03:04 +01:00
|
|
|
{ rank = same; "log(a)"; "a++"; }
|
|
|
|
{ rank = max; "a++"; "log(a)"; }
|
2019-12-14 15:27:01 +01:00
|
|
|
"a++" [style="filled,bold"];
|
|
|
|
// Control flow
|
|
|
|
"f()" -> "while (a > 0)";
|
|
|
|
"f()" -> "int a = 1";
|
|
|
|
"while (a > 0)" -> "if (a > 10)";
|
|
|
|
"if (a > 10)" -> "break";
|
2019-12-19 13:03:04 +01:00
|
|
|
"break" -> "log(a)";
|
2019-12-14 15:27:01 +01:00
|
|
|
"break" -> "a++";
|
|
|
|
"break" -> "while (a > 0)";
|
|
|
|
// Data flow
|
|
|
|
{ edge [color = red];
|
|
|
|
"int a = 1" -> "while (a > 0)";
|
|
|
|
"int a = 1" -> "if (a > 10)";
|
2019-12-19 13:03:04 +01:00
|
|
|
"int a = 1" -> "log(a)";
|
|
|
|
"int a = 1" -> "a++";
|
2019-12-14 15:27:01 +01:00
|
|
|
"a++" -> "a++";
|
|
|
|
"a++" -> "while (a > 0)";
|
|
|
|
"a++" -> "if (a > 10)";
|
2019-12-19 13:03:04 +01:00
|
|
|
"a++" -> "log(a)" [constraint = true];
|
2019-12-14 15:27:01 +01:00
|
|
|
}
|
|
|
|
}
|