MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / getGraphStats

Function getGraphStats

src/core/memory-graph.ts:366–375  ·  view source on GitHub ↗
(rootDir: string)

Source from the content-addressed store, hash-verified

364}
365
366export async function getGraphStats(rootDir: string): Promise<{ nodes: number; edges: number; types: Record<string, number>; relations: Record<string, number> }> {
367 const graph = await loadGraph(rootDir);
368 const types: Record<string, number> = {};
369 const relations: Record<string, number> = {};
370
371 for (const node of Object.values(graph.nodes)) types[node.type] = (types[node.type] ?? 0) + 1;
372 for (const edge of Object.values(graph.edges)) relations[edge.relation] = (relations[edge.relation] ?? 0) + 1;
373
374 return { nodes: Object.keys(graph.nodes).length, edges: Object.keys(graph.edges).length, types, relations };
375}

Callers 4

toolUpsertMemoryNodeFunction · 0.85
toolCreateRelationFunction · 0.85

Calls 1

loadGraphFunction · 0.85

Tested by

no test coverage detected