Wolfram Computation Meets Knowledge

SymbolDependencyGraph

Contributed by: Richard Hennigan (Wolfram Research)

Create a graph of symbol dependencies

ResourceFunction["SymbolDependencyGraph"][symbol]

Display a Graph corresponding to the symbol dependencies of symbol.

Details and Options

An edge a -> b will appear in the graph if the symbol b appears in the definition of symbol a.
SymbolDependencyGraph takes the same options as Graph.

Examples

Basic Examples

Use the function:

In[1]:=
a := Hold[b, c];
b := 1;
c := d;
d := Hold[a, b, e];
e := 2;
ResourceFunction["SymbolDependencyGraph"][a, VertexLabels -> "Name", ImageSize -> 150]
Out[1]=

More Examples

Scope

Retrieve the ResourceFunction:

In[2]:=
ResourceFunction["SymbolDependencyGraph"]
Out[2]=

Retrieve the ResourceObject:

In[3]:=
ResourceObject["SymbolDependencyGraph"]
Out[3]=

See how a function relies on other functions:

In[4]:=
ResourceFunction[
 "SymbolDependencyGraph"][GeneralUtilities`PrintDefinitions, VertexLabels -> Placed["Name", Tooltip]]
Out[4]=

Applications

See how symbols in a context are related:

In[5]:=
symbols = ToExpression[Names["GeneralUtilities`*"], InputForm, HoldComplete];
In[6]:=
g = ResourceFunction["SymbolDependencyGraph"][symbols, VertexLabels -> Placed["Name", Tooltip]];
In[7]:=
VertexDelete[g, "symbols"]
Out[7]=

Resource History