Expand description
Graph-theoretic code-analysis metrics over a petgraph::Graph<N, E> where
N: srcgraph_core::ClassNode and E: srcgraph_core::EdgeKind.
Each metric is behind its own cargo feature, so a consumer compiles only
what it uses (default = ["all"]):
scc— strongly-connected components (circular dependencies)lcom4— LCOM4 cohesion (low-cohesion types are split candidates)betweenness— betweenness centrality (architectural chokepoints / god nodes)instability— Martin’s instability I = Ce/(Ca+Ce) + Stable-Dependencies-Principle violationsclone_detection— n-gram fingerprint clone / near-duplicate detection
Modules§
- betweenness
- Betweenness centrality — Brandes’ algorithm. The headline perf target versus networkx’s Python-loop O(VE) implementation.
- clone_
detection - Clone detection via n-gram Jaccard similarity on per-method fingerprint token streams.
- instability
- Martin’s instability metric — per-namespace afferent / efferent coupling from inter-package edges, and Stable Dependencies Principle violations.
- lcom4
- LCOM4 cohesion — connected components on the per-class method-field bipartite graph. LCOM4 = number of components (1 = cohesive).
- scc
- Strongly-connected components — Tarjan via
petgraph::algo::tarjan_scc, plus condensation DAG and per-SCC status rating.