export async function computeAtomGraphDensity(store, options) {
    const atoms = await store.listAtoms({ project: options.project, limit: 10000 });
    const projectAtomIds = new Set(atoms.map((a) => a.id));
    const edges = await store.listAtomRelations({ limit: 100000 });
    const projectEdges = edges.filter((e) => projectAtomIds.has(e.fromAtomId));
    const byKind = {};
    const bySource = {};
    for (const e of projectEdges) {
        byKind[e.relationType] = (byKind[e.relationType] ?? 0) + 1;
        bySource[e.inferenceSource] = (bySource[e.inferenceSource] ?? 0) + 1;
    }
    return {
        atoms: atoms.length,
        edges: projectEdges.length,
        edgesPerAtom: atoms.length === 0 ? 0 : projectEdges.length / atoms.length,
        byKind,
        bySource,
    };
}
