data = {
const TAU = Math.PI * 2;
const width2 = width * 0.5;
const height2 = height * 0.5;
const nodes = getCombinations(things).map((arr, index) => {
const group = arr.length;
const id = arr.join("");
const label = arr.join(", ");
if (group === 1) {
const x = Math.cos((index / things.length) * TAU) * 300 + width2;
const y = Math.sin((index / things.length) * TAU) * 300 + height2;
return {
group,
id,
label,
fixed: true,
x,
y
};
}
return {
group,
id,
label
};
});
const links = [];
nodes.forEach((node) => {
if (node.group > 1) {
node.id.split("").forEach((id) => {
links.push({
source: id,
target: node.id
});
});
}
});
return {
nodes,
links
};
}