Visualizing a Julia AST (abstract syntax tree) as a tree

250 views
Skip to first unread message

David P. Sanders

unread,
Sep 21, 2016, 5:24:52 PM9/21/16
to julia-users
Hi,

In case it's useful for anybody, the following notebook shows how to use the LightGraphs and TikzGraphs packages
to visualize a Julia abstract syntax tree (Expression object) as an actual tree:


Currently it requires the master branch of TikzGraphs.jl.

It would be great to have some kind of Julia snippet repository for this kind of thing that is less than a package but
provides some kind of useful functionality. 

David.


David P. Sanders

unread,
Sep 22, 2016, 10:12:39 AM9/22/16
to julia-users



Here's an example of the output.

Tom Breloff

unread,
Sep 22, 2016, 10:29:11 AM9/22/16
to julia-users
Hi David this is very cool and useful!  I'd be happy to have it in PlotRecipes if you don't find a better home for it.  If there's a generic function to produce an adjacency list then we could use my graph recipes.  When I have the time (i.e. soonish when I really want nicer graphs) I plan on incorporating the new GraphLayout into the recipes.  Let me know.

Tom

David P. Sanders

unread,
Sep 22, 2016, 10:48:50 AM9/22/16
to julia-users


El jueves, 22 de septiembre de 2016, 10:29:11 (UTC-4), Tom Breloff escribió:
Hi David this is very cool and useful!  I'd be happy to have it in PlotRecipes if you don't find a better home for it.  If there's a generic function to produce an adjacency list then we could use my graph recipes.  When I have the time (i.e. soonish when I really want nicer graphs) I plan on incorporating the new GraphLayout into the recipes.  Let me know.

Hi Tom,

That sounds like a pretty good idea, though I have to say I haven't grokked PlotRecipes yet.

Since LightGraphs.jl doesn't support labelled graphs, maybe 


is the right solution? Do you have any suggestions about this?
Reply all
Reply to author
Forward
0 new messages