Ex4pm.Domain.ProcessGraphProjector (ex4pm v26.9.9)

Copy Markdown View Source

Real OTP :digraph/:digraph_utils-backed topology projection over an Ex4pm.Domain.ProcessModel record's :model map. Zero new hex deps.

Consumable two ways: directly via topology/1 (a plain map -> map function), or wired as an Ash module calculation on a resource (see Ex4pm.Domain.ProcessModel's calculate :topology declaration).

Summary

Functions

Projects %{"nodes" => [...], "edges" => [[from, to], ...]} (or the atom- keyed equivalent) into %{topsort: [...] | nil, components: [[...], ...]} using a real, temporary :digraph.graph().

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

load(query, opts, context)

Callback implementation for Ash.Resource.Calculation.load/3.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.

topology(model)

@spec topology(map()) :: %{topsort: [term()] | nil, components: [[term()]]}

Projects %{"nodes" => [...], "edges" => [[from, to], ...]} (or the atom- keyed equivalent) into %{topsort: [...] | nil, components: [[...], ...]} using a real, temporary :digraph.graph().

topsort is nil when the graph has a real cycle (honest -- :digraph itself returns false for :topsort/1 on a cyclic graph, not a crash).