Topological sorting via Kahn's algorithm and cycle detection via Tarjan's SCC.
Summary
Functions
Find a nullable FK edge in a cycle that can be deferred. Returns the edge or nil.
Tarjan's SCC algorithm to identify exact cycles among remaining nodes. Returns only SCCs with more than 1 node.
Topological sort of nodes by FK dependency edges.
Returns %{sorted: [String.t()], cycles: [[String.t()]]}.
Types
Functions
Find a nullable FK edge in a cycle that can be deferred. Returns the edge or nil.
Tarjan's SCC algorithm to identify exact cycles among remaining nodes. Returns only SCCs with more than 1 node.
Topological sort of nodes by FK dependency edges.
Returns %{sorted: [String.t()], cycles: [[String.t()]]}.
After detecting cycles, runs a second pass to sort nodes that depend on cycle members but aren't in cycles themselves.