Skip to main content

Module import_graph

Module import_graph 

Source
Expand description

Import dependency graph and circular-import detection.

Given a set of parsed Modules, this module builds a directed dependency graph where each edge A → B means “module A imports symbols from module B”. It then runs a depth-first search to detect back-edges (cycles) and returns each cycle as an ImportCycle.

Only edges between modules that are present in the provided slice are considered; imports from modules that were not provided are ignored.

Structs§

ImportCycle
A circular import chain detected among a set of modules.

Functions§

detect_cycles
Detect circular imports among a slice of parsed modules.
topological_order
Compute a topological generation order for a set of modules.