mobile = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);
svg.append("rect")
.attr("height", height)
.attr("width", width)
.style("fill", "none")
.style("stroke", "none");
const sim = d3.forceSimulation(nodes)
.force("collide", d3.forceCollide().radius(d => d.r))
.force("charge", d3.forceManyBody().strength(1))
.force("bounding-circle", () => {
nodes.forEach(node => {
node.x = Math.max(margin.left, Math.min(width - margin.right, node.x));
node.y = Math.max(margin.top, Math.min(height - margin.bottom, node.y));
})
})
.alphaDecay(0.5);
const [node, edge] = draw_nodes(svg, nodes, null, true, false);
sim.on("tick", () => {
node
.attr("cx", d => d.x)
.attr("cy", d => d.y);
node.attr('transform', d => `translate(${d.x},${d.y})`);
});
return svg.node()
}