Overview
TheVisualiser decorator accepts four configuration parameters that control what information is displayed in the recursion tree and how nodes are styled. All parameters are optional and have sensible defaults.
Parameters
ignore_args
List of argument names to exclude from node labels in the visualization.
list or None
Default: None (internally becomes ['node_num'])
Behavior:
- When
None, only the internalnode_numargument is ignored - When a list is provided, those argument names are added to the ignore list alongside
node_num - Ignored arguments are excluded from the label displayed on each node, but are still passed to the function
- Hide internal implementation details (e.g., memoization caches)
- Reduce visual clutter by hiding auxiliary parameters
- Focus on the core recursive parameter
show_argument_name
Controls whether argument names are displayed alongside their values in node labels.
bool
Default: True
Behavior:
- When
True: displays arguments askey=valuepairs (e.g.,fib(n=5)) - When
False: displays only the values (e.g.,fib(5))
- Show argument names for clarity in functions with multiple parameters
- Hide argument names for a cleaner look with single-parameter functions
- Match preferred function call syntax style
show_return_value
Controls whether the return value of each function call is displayed in the node.
bool
Default: True
Behavior:
- When
True: appends the return value to the node label with=> {result}format - When
False: shows only the function call signature without the result - Special handling for
"record"shaped nodes: separates return value by a row delimiter (|) instead of a newline
- Trace the computed values through the recursion tree
- Verify correctness of recursive calculations
- Hide return values to reduce visual complexity
The return value display format automatically adapts when using the
"record" shape, using graphviz’s row separator syntax for cleaner presentation.node_properties_kwargs
Dictionary of graphviz node properties to customize the visual appearance of nodes.
dict
Default: {}
Behavior:
- Accepts any valid graphviz node attributes as key-value pairs
- Properties are applied to all nodes in the recursion tree
- Values are inserted into the DOT language graph definition
| Property | Description | Example Values |
|---|---|---|
shape | Node shape | "record", "box", "ellipse", "circle", "diamond" |
color | Border color | "#f57542", "red", "blue" |
style | Node style | "filled", "solid", "dashed", "dotted", "bold" |
fillcolor | Fill color (requires style="filled") | "grey", "#fff3af", "lightblue" |
fontname | Font family | "Arial", "Helvetica", "Courier" |
fontsize | Font size in points | "12", "14", "16" |
fontcolor | Text color | "black", "white", "#333333" |
For a complete list of supported graphviz node attributes, refer to the graphviz node attribute documentation.