export function toGraphElements(input) {
    const nodes = input.items.map((i) => ({
        data: {
            id: i.id,
            label: i.title,
            itemType: i.itemType,
            score: i.score,
            labels: (i.labels ?? []).join(','),
        },
    }));
    const edges = input.relations.map((r) => ({
        data: {
            id: `${r.sourceId}->${r.targetId}:${r.kind}`,
            source: r.sourceId,
            target: r.targetId,
            kind: r.kind,
        },
    }));
    return [...nodes, ...edges];
}
