Paradigm.Graph.Canonical (paradigm v0.3.0)
Converts graphs into canonical Elixir structs, and vice versa.
Summary
Functions
Converts an Elixir struct into graph nodes using the Graph protocol.
Converts a graph node into its canonical Elixir struct representation.
Functions
@spec struct_to_graph(Paradigm.Graph.t(), struct(), Paradigm.Graph.node_id()) :: Paradigm.Graph.t()
Converts an Elixir struct into graph nodes using the Graph protocol.
- Uses the struct's module name as the class_id
- Converts nested structs into references
- Inserts all nodes into the graph
@spec to_struct(Paradigm.Graph.t(), Paradigm.Graph.node_id()) :: struct() | nil
Converts a graph node into its canonical Elixir struct representation.
- The struct name is derived from the node's class
- All
%Paradigm.Graph.Node.Ref{}values are expanded in place - Cycle detection prevents infinite recursion