Wolfram Research

Function Repository Resource:

SymbolDependencyGraph

Source Notebook

Create a graph of symbol dependencies

Contributed by: Richard Hennigan (Wolfram Research)

ResourceFunction["SymbolDependencyGraph"][symbol]

displays a Graph corresponding to the symbol dependencies of symbol.

Details and Options

An edge ab 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]=

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]:=
VertexDelete[g, "symbols"]
Out[5]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information