rgraph = {
const nodes = rdata.nodes.map(({index, Ancestry, Income, Race, Continent, Race_group}) => ({
index,
Ancestry,
Income,
Race,
Continent,
Race_group,
sourceLinks: [],
targetLinks: []
}));
const nodeByAncestry = new Map(nodes.map(d => [d.Ancestry, d]));
const links = rdata.links.map(({index, source, target, value}) => ({
index,
source: nodeByAncestry.get(source),
target: nodeByAncestry.get(target),
value
}));
for (const link of links) {
const {index, source, target, value} = link;
}
return {nodes, links};
}