Skip to main content

Module lcom4

Module lcom4 

Source
Expand description

LCOM4 cohesion — connected components on the per-class method-field bipartite graph. LCOM4 = number of components (1 = cohesive).

See DESIGN.md (Phase 1) at the workspace root.

@yah:ticket(R152-T3, “metrics::lcom4 — connected components on per-class method-field bipartite graph”) @yah:assignee(agent:claude) @yah:at(2026-05-12T22:14:28Z) @yah:status(review) @yah:parent(R152) @yah:verify(“cargo test -p srcgraph-metrics lcom4”) @yah:handoff(“Implemented LCOM4: build_method_graph (UnGraph from MethodConnectivity), compute_lcom4 (petgraph connected_components, None for empty), compute_lcom4_all (per-class scores generic over ClassNode+EdgeKind; None when methodConnectivity is absent). 6 tests pass; covers cohesive, disjoint, isolated, empty, ghost-endpoint, and mixed-graph cases.”)

Structs§

LcomScore
LCOM4 score for a single class.

Functions§

build_method_graph
Build the undirected method graph from a MethodConnectivity record.
compute_lcom4
Connected-component count on an undirected method graph.
compute_lcom4_all
Compute LCOM4 for every class node in graph.