File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -304,11 +304,22 @@ <h3 id="emulation">Emulation</h3>
304304< h3 id ="graphs "> Graphs</ h3 >
305305< pre > < code class ="language-python "> # Get the control flow graph of the main function (and display it)
306306Function("main").control_flow.show()
307-
308- def callback(func):
307+ </ code > </ pre >
308+ < p > Graph visualisation is not the most useful feature of this library, but it
309+ looks cool:</ p >
310+ < p > < img alt ="" src ="../graph.png " /> </ p >
311+ < p > And you can easily build the graph yourself:</ p >
312+ < pre > < code class ="language-python "> g = Graph.create()
313+ foo = g.vertex("foo")
314+ bar = g.vertex("bar")
315+ g.edge(foo, bar)
316+ g.show()
317+ </ code > </ pre >
318+ < p > Or do some actually useful stuff with graph algorithms:</ p >
319+ < pre > < code class ="language-python "> def callback(func):
309320 print("visiting", func)
310321
311- # Traverse the call graph of the program, while calling the callback
322+ # Traverse the program functions in topological order, and print the function names.
312323Program.call_graph.dfs(callback)
313324</ code > </ pre >
314325< h2 id ="conventions "> Conventions</ h2 >
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments