refactor(8.0): graph analytics contract — intent names, not algorithm names

The public brain.graph.* surface and the GraphAccelerationProvider seam must name
operations by INTENT, not by the algorithm that happens to implement them — so a
plugin can swap algorithms without the contract lying. The JS fallback computes
communities via connected-components and rank via PageRank, but a native provider
(cor) is free to use Louvain/Leiden for communities and personalized-PageRank /
eigenvector-centrality for rank: same intent, different algorithm, same name.

Renamed the (not-yet-implemented) Phase-C analytics methods + their option/result
types on GraphAccelerationProvider:
- pageRank -> rank            (PageRankOptions -> RankOptions; dropped the
                               pagerank-internal damping/maxIterations/tolerance
                               knobs from the contract — each impl tunes itself)
- connectedComponents -> communities   (ComponentsOptions -> CommunitiesOptions,
                               mode:'weak'|'strong' -> directed?:boolean;
                               GraphComponents -> GraphCommunities, componentIds/
                               Count -> communityIds/Count)
- shortestPath -> path        (ShortestPathOptions -> PathOptions; weight -> by:'hops'|'weight')
- neighborhoodSample -> sample (NeighborhoodSampleOptions -> SampleOptions)
- topByDegree -> mostConnected (TopByDegreeOptions -> MostConnectedOptions)

traverse / edgesForNode / graphCursorOpen/Next/Close + GraphScores/GraphPath/
OpaqueIdSet/Subgraph are UNCHANGED — everything cor has already built is untouched;
this is a pure pre-implementation rename (cor coordinated). JSDoc reworded to state
the algorithm is the provider's choice. index.ts exports + the native-seam test
mock updated. tsc/unit 1517/integration 599 green.
This commit is contained in:
David Snelling 2026-06-22 09:54:01 -07:00
parent 96d9c0b92c
commit f3e69110f0
3 changed files with 75 additions and 59 deletions

View file

@ -194,13 +194,13 @@ export type {
GraphCursorOptions,
GraphCursorChunk,
GraphScores,
GraphComponents,
GraphCommunities,
GraphPath,
PageRankOptions,
ComponentsOptions,
ShortestPathOptions,
NeighborhoodSampleOptions,
TopByDegreeOptions
RankOptions,
CommunitiesOptions,
PathOptions,
SampleOptions,
MostConnectedOptions
} from './plugin.js'
// Export embedding functionality