I've been experimenting with applying the Label Propagation Algorithm (LPA) to AST dependency graphs. By treating variables and functions as nodes, we can identify communities (clusters) within a single file.
I integrated this into a tool for Claude Code called VHO. It helps dismantle monolithic React/Vue hooks by grounded mathematical analysis rather than just LLM prediction.
Technical breakdown:
AST Parsing: To build the reference graph. LPA: To find the optimal boundaries for extraction. Agentic Execution: Using Claude Code to perform the actual file I/O and refactoring. Is graph-theory-assisted refactoring the future of AI coding? I'd love to discuss the methodology.