4 ms·
I've always found it incredibly challenging to layout control-flow graphs (used a lot by compilers), so nice that this exists!
by pbiggar 8y ago
I've always found it incredibly challenging to layout control-flow graphs (used a lot by compilers), so nice that this exists!
- Someone 8y agoI don’t understand that remark. This library is for directed acyclic graphs. Control flow graphs are directed, but generally have cycles.
- pbiggar 8y agoYes, there are cycles, but you want to draw them as DAGs because the "backlink" (the thing that loops back up to the entry point of a loop) isn't on the same footing as the rest of edges.
- Someone 8y agoThe layout still needs to make room for the back links, doesn’t it? Thinking of that, with CFGs, you know which edges are backlinks, so you can put the backlinks in in reverse direction, do the layout, and then draw them with the arrow heads at the “wrong” side. So, yes, I see that it can be useful.
- DoofusOfDeath 8y agoIt's sometimes helpful, during program analysis, to collapse each strongly-connected component (SCC) of a directed graph into a single placeholder node representing that SCC. When you do this, you're guaranteed that the resulting graph is acyclic.