Extracts scalar computation graphs from MicrogradEx.Value expressions.
This module returns plain Elixir data structures suitable for Livebook tables, documentation, and Graphviz DOT export. It does not depend on Livebook, Graphviz, or browser rendering.
Summary
Functions
Returns parent-to-child graph edges reachable from a final Value.
Returns both nodes and edges for a scalar computation graph.
Returns graph nodes reachable from a final Value.
Returns a Graphviz DOT representation of a scalar computation graph.
Types
Functions
@spec edges(MicrogradEx.Value.t()) :: [edge_row()]
Returns parent-to-child graph edges reachable from a final Value.
@spec graph(MicrogradEx.Value.t(), MicrogradEx.Gradients.t() | nil) :: %{ nodes: [node_row()], edges: [edge_row()] }
Returns both nodes and edges for a scalar computation graph.
@spec nodes(MicrogradEx.Value.t(), MicrogradEx.Gradients.t() | nil) :: [node_row()]
Returns graph nodes reachable from a final Value.
Nodes are returned in topological order from inputs toward the selected
output. When a Gradients table is supplied, each row also includes :grad.
@spec to_dot(MicrogradEx.Value.t(), MicrogradEx.Gradients.t() | nil) :: String.t()
Returns a Graphviz DOT representation of a scalar computation graph.
Graphviz is not required to call this function; it only returns text.