replacement - Transform an expression into a graph that can be plotted with TreeGraph (not TreeForm)
I would like to plot an expression (like TreeForm does), but using the new TreeGraph functionality.
TreeGraph takes as input a set of edges (of the form a -> b), so it seems that to solve the problem it is necessary to turn an expression into a set of edges. For example Sin[Plus[a, b]] would need to be transformed into: {Sin -> Plus, Plus -> a, Plus -> b}.
How can this transformation be done for any Mathematica expression? Thanks!
Comments
Post a Comment