(rootDir: string)
| 364 | } |
| 365 | |
| 366 | export 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 | } |
no test coverage detected