pub struct Cycle {
pub path: Vec<Name>,
pub others: Vec<Name>,
pub edges: Vec<CycleEdge>,
}Expand description
A dependency cycle: one loop through a strongly-connected component of the
import graph, alongside the import that created each edge between consecutive
modules (wrapping around to the first), and any component member that loop does
not pass through.
Fields§
§path: Vec<Name>One cycle within the strongly-connected component, in cycle order —
what the summary note is built from. Not necessarily every module in the
component: a component with several overlapping loops has more than one
cycle in it, and picking the shortest one through a single start node (see
cycle_walk) can leave others out. Finding a cycle that covers every
member is the Hamiltonian cycle problem, and no such cycle need exist, so
this does not try; the members left out are in Cycle::others instead,
and the note names them so a user does not break one loop and immediately
hit the next one hiding in the same component.
others: Vec<Name>The other modules in the same component: genuinely part of the circular
dependency, but not on the particular cycle path names. Empty whenever
path already covers the component, which every fixture and every real
import graph seen so far is.
edges: Vec<CycleEdge>edges[i] is the import written in path[i] that names path[i + 1]
(or path[0], for the last edge). Same length as path, and every entry
is a real import, because cycle_walk only ever returns a path whose
consecutive pairs are edges of the graph.