Expand description
Static dependency-graph analyses (God-Nodes, import cycles).
These run on the real directed dependency edges — import and reexport —
and deliberately exclude the co-location heuristics (sibling, cochange)
and the ambiguous module edges. That way the results reflect genuine code
dependencies (graphify-style) instead of directory layout coincidences.
Structs§
- Bridge
Centrality - Betweenness result with sampling provenance, so callers can disclose when the values are an estimate (large graphs) rather than the exact Brandes result.
- Bridge
Node - A file with high betweenness centrality.
- GodNode
- A highly connected file in the dependency graph.
- Import
Cycle - A circular dependency: a set of files that import each other.
- Surprising
Connection - An unexpected coupling between two files.
Constants§
- DEP_
EDGE_ KINDS - Edge kinds that represent a genuine directed code dependency
(
fromdepends onto).
Functions§
- compute_
bridge_ centrality - Like
compute_bridge_nodesbut also reports whether the result was sampled and over how many sources, for honest disclosure in reports/UI. - compute_
bridge_ nodes - Returns the top
limitbridge nodes (betweenness > 0), highest first. Thin wrapper overcompute_bridge_centralityfor callers that don’t need the sampling metadata. - compute_
god_ nodes - Ranks files by total dependency degree (fan-in + fan-out) and returns the top
limit. Deterministic: ties broken by path so the output is stable across rebuilds. - dependency_
edges - Directed dependency edges as
(from, to)pairs, with self-loops removed. Borrows fromedgesto avoid allocating new strings. - edge_
confidence - Confidence that an edge represents a real relationship, in
0.0..=1.0. - find_
import_ cycles - Finds import cycles (SCCs of size >= 2), largest first, capped at
limit. Output is deterministic. - find_
surprising_ connections - Returns the top
limitsurprising connections, highest score first. Deterministic.communitymaps file path → community id (may be partial). - is_
dependency_ kind - True when an edge kind is a genuine directed dependency.