Skip to main content

topo_levels

Function topo_levels 

pub fn topo_levels(adj: &[Vec<usize>], sccs: &[Vec<usize>]) -> Vec<u32>
Expand description

Per-node topological layer of the import graph: the longest path (in the SCC condensation) from a source to the node’s SCC. Cycle members share their SCC’s level.

Level 0 = files that nothing imports (entry points / main); deeper levels are foundations the upper layers depend on. An edge that runs from a deeper level back up to a shallower one is a back-edge — and every back-edge sits inside a cycle, so the layering violations are exactly the dependency cycles (see dependency-cycles).