Graph Min-Cut and Partitioning
A minimum cut is the cheapest set of edges whose removal splits a graph in two. On a code graph it marks where a module boundary costs least; around one node it marks the edge of that node's cluster.
Tools
| Question | Call |
|---|---|
| Natural split points in this codebase | npx @claude-flow/cli analyze boundaries src/ (alias mincut) |
| Which cluster this knowledge-graph node is in, and what its weakest boundary is | mcp__claude-flow__agentdb_graph-pathfinder with algorithm: "dynamic-mincut" |
| Ranked neighbours, influence | same tool with algorithm: "personalized-pagerank" |
Example pathfinder call:
{ "seedNodeId": "entity:auth-module", "query": "auth boundary", "algorithm": "dynamic-mincut",
"depth": 3, "threshold": 0, "complexityBudget": { "maxMillis": 2000 } }
The response includes paths (the nodes on the seed's side of the cut, nearest first) and a mincut block with cutValue, cutEdges, seedSideSize, otherSideSize and backend.
Reading the result
backend: "mincut-wasm"means the exact cut came from the wasm solver thatruvectorbrings in. It is about 30x faster than the JS Stoer-Wagner fallback at 1,000 nodes (187 ms vs 6 s).backend: "js-fallback"means ruvector is not installed. The JS fallback only runs on neighbourhoods of 300 nodes or fewer. Runnpm i ruvectorto lift that limit.- A
cutValueclose to the seed's own degree means the seed is weakly attached, so the cut isolates the seed rather than a cluster. Try a largerdepth. spectral-sparsifyandconnected-component-churnare k-hop approximations for now. The response marks them withimplementation.
