module Rigor::ModuleGraph::CycleDetector

Finds dependency cycles in an Edge list.

Tarjan’s strongly-connected-components, sized β‰₯ 2 (a SCC of 1 is a single node with no self-loop and represents no cycle). We also surface single-node self-loops if any edge points a constant at itself.

Returns an array of Cycle, where each Cycle carries the list of node names in the cycle in a canonical rotation: smallest name first. The actual edge instances making up each cycle are not surfaced β€” for visualisation we only need the node set β€” but a kind filter is offered so callers can ask β€œdo these edges form a cycle using only include / inherits?”