Adding New Nodes to a Cluster Force

http://stackoverflow.com/questions/22712913/adding-new-nodes-to-a-clustered-force-layout

HTML

<button type="button" value="Add node">Add node</button>

CSS

body {
    background-color: #eaeaea;
}
svg {
    position:fixed;
}

JavaScript

var width = 1280,
    height = 720,
    padding = 10, // separation between same-color nodes
    clusterPadding = 25, // separation between different-color nodes
    maxRadius = 50;

var n = 10, // total number of nodes
    m = 4; // number of distinct clusters

var color = d3.scale.ordinal()
    .domain(m)
    .range(["#FEE412", "#FCD719", "#FACA1E", "#F8BE22", "#F6B124", "#F4A426"]);

// The largest node for each cluster.
var clusters = new Array(m);

var nodes = d3.range(n).map(function () {
    var i = Math.floor(Math.random() * m),
        r = Math.sqrt((i + 1) / m * -Math.log(Math.random())) * maxRadius,
        d = {
            cluster: i,
            radius: r,
            x: Math.cos(i / m * 2 * Math.PI) * 200 + width / 2 + Math.random(),
            y: Math.sin(i / m * 2 * Math.PI) * 200 + height / 2 + Math.random()
        };
    if (!clusters[i] || (r > clusters[i].radius)) clusters[i] = d;
    return d;
});

var force = d3.layout.force()
    .nodes(nodes)
    .size([width, height])
    .gravity(0)
    .charge(0)
    .on("tick", tick)
    .start();

var svg = d3.select("body").append("svg")
    .attr("width", "100%")
    .attr("height", "100%")
    .attr("viewBox", "0 0 1280 720");

var node = svg.selectAll("circle")
    .data(nodes)
    .enter().append("circle")
    .attr("class", "node")
    .style("fill", function (d) {
    return color(d.cluster);
})
    .call(force.drag);

// node.append("text")
// .data(emotions)
// .attr("dy", ".3em")
// .style("text-anchor", "middle")
// .text(function(d) { return d.emotions; });

node.transition()
    .duration(1000)
    .delay(function (d, i) {
    return i * .5;
})
    .attrTween("r", function (d) {
    var i = d3.interpolate(0, d.radius);
    return function (t) {
        return d.radius = i(t);
    };
});

function tick(e) {
console.log(e.alpha)
    node.each(cluster(3 * e.alpha * e.alpha))
        .each(collide(.08))
        .attr("cx", function (d) {
        return d.x;
    })
        .attr("cy",...