{
const extent = d3.extent(data.links, l => l.value);
const minValue = extent[0];
const maxValue = extent[1];
const midValue = (minValue + maxValue) / 2;
const colorScale = d3.scaleLinear()
.domain([minValue, midValue, maxValue])
.range(["green", "yellow", "red"]);
return ForceGraph(data, {
nodeId: d => d.id,
nodeGroup: d => d.group,
nodeTitle: d => `${d.id}\n${d.group}`,
nodeRadius: 10,
linkFill: l => colorScale(l.value),
linkStroke: l => colorScale(l.value),
linkStrokeWidth: l => Math.sqrt(l.value)*5,
nodeStrength: -100,
linkStrength: 0.001,
width,
height: 600,
invalidation
})
}