Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

CallGraph

Guides

  • Call graphs creation

Tech Notes

  • Call graphs generation for context functions

Symbols

  • CallGraphAddPrintDefinitionsButtons
  • CallGraphAddUsageMessages
  • CallGraphBiColorCircularEmbedding
  • CallGraph
  • FunctionDependencies
  • NodeInducedEdges
  • NodeInducedInEdges
  • NodeInducedOutEdges
Call graphs generation for context functions
Introduction
Usage examples
General design
Options
Contexts to analyze
Possible issues
Introduction
This paclet --
AntonAntonov/CallGraph
-- provides functions for making a call graph between the functions that belong to specified contexts.
Paclet's main function is CallGraph that gives a graph with vertices that are functions names and edges that show which function calls which other functions. With the default option values the graph vertices labeled with function names that have as tooltips the corresponding usage messages.
Load the paclet
In[19]:=
Needs["AntonAntonov`CallGraph`"]
General design
The main package function is CallGraph. With the default values of its options CallGraph produces a graph with labeled nodes and the labels have tooltips that show the usage messages of the functions. It assumed that this is would be the most generated type of call graph when studying the code of different sets of packages.
The argument of CallGraph is a context string or a list of context strings.
We can make simple, non-label, non-tooltip graph using CallGraph[__, "UsageTooltips"False].
The simple graph can be modified with the functions:
◼
  • CallGraphAddUsageMessages
  • ◼
  • CallGraphAddPrintDefinitionsButtons
  • ◼
  • CallGraphBiColorCircularEmbedding
  • Each of those functions is decorating the simple graph in a particular way.
    Contexts to analyze
    Here we load the paclet
    StianRamsnes/MaXrd
    :
    Install and load paclet
    In[11]:=
    PacletInstall["StianRamsnes/MaXrd"]​​Needs["StianRamsnes`MaXrd`"]
    Out[11]=
    PacletObject
    Name: StianRamsnes/MaXrd
    Version: 4.0.0
    
    Usage examples
    Make a call graph
    In[13]:=
    CallGraph
    ["StianRamsnes`MaXrd`",ImageSize900]
    Out[13]=
    Generate a call graph by excluding symbols
    In[17]:=
    gr=
    CallGraph
    ["StianRamsnes`MaXrd`",ExclusionsMap[ToExpression,Names[{"StianRamsnes`MaXrd`*Data","StianRamsnes`MaXrd`*Q"}]],ImageSize900]
    Out[17]=
    Generate call graph with buttons to print definitions
    In[18]:=
    gr0=
    CallGraph
    ["StianRamsnes`MaXrd`","UsageTooltips"False];​​gr1=
    CallGraphAddPrintDefinitionsButtons
    [gr0,GraphLayoutAutomatic,ImageSize900]
    Out[19]=
    Generate circular embedding graph color
    In[22]:=
    cols=RandomSample[ColorData["Rainbow"]/@Rescale[Range[VertexCount[gr1]]]];​​
    CallGraphBiColorCircularEmbedding
    [gr,"VertexColors"cols,ImageSize900,"EdgeThickness"Thick]
    Out[23]=
    Options
    ◼
  • "PrivateContexts"
    Should the functions of the private contexts be included in the call graph.
  • ◼
  • "SelfReferencing"
    Should the self referencing edges be excluded or not.
  • ◼
  • "AtomicSymbols"
    Should atomic symbols be included in the call graph.
  • ◼
  • Exclusions
    Symbols to be excluded from the call graph.
  • ◼
  • "UsageTooltips"
    Should vertex labels with the usage tooltips be added.
  • ◼
  • "UsageTooltipsStyle"
    The style of the usage tooltips.
  • Possible issues
    ◼
  • With large context (e.g. “System`”) the call graph generation might take long time.
  • ◼
  • With "PrivateContexts"False the call graph will be empty if the public functions do not depend on each other.
  • ◼
  • For certain packages the scanning of the down values would produce (multiple) error messages or warnings.
  • © 2025 Wolfram. All rights reserved.

    • Legal & Privacy Policy
    • Contact Us
    • WolframAlpha.com
    • WolframCloud.com