<html>
  <head>
    <title>Minimal force-directed layout</title>
  </head>

  <body>
    <svg width="700" height="500">
    </svg>
    <script src='http://d3js.org/d3.v3.min.js'></script>
    <script>
      var nodes = [ { "x": 350, "y": 200 }, { "x": 200, "y": 400 }, { "x": 500, "y": 400} ];
      var links = [ { "source": 0, "target": 1 }, {"source": 1, "target":2}, {"source":2, "target":0}];
      var svg = d3.select("svg");

      var lines = svg.selectAll("line").data(links).enter().append("line")
      .attr("x1", function (d) { return nodes[d.source].x; })
      .attr("y1", function (d) { return nodes[d.source].y; })
      .attr("x2", function (d) { return nodes[d.target].x; })
      .attr("y2", function (d) { return nodes[d.target].y; })
      .attr("style", "stroke: #000; stroke-width: 1px");

      var circles = svg.selectAll("circle")
      .data(nodes).enter().append("circle")
      .attr("cx", function(d) { return d.x; })
      .attr("cy", function(d) { return d.y; })
      .attr("r", 30);

      var delay = 100; // milliseconds

      var force = d3.layout.force().size([700,500]).nodes(nodes).links(links);
      force.linkDistance(100);

      force.on("tick", function () {
        circles.transition().ease('linear').duration(delay)
        .attr("cx", function(d) { return d.x; })
        .attr("cy", function(d) { return d.y; });

        lines.transition().ease('linear').duration(delay)
        .attr("x1", function(d) { return d.source.x; })
        .attr("y1", function(d) { return d.source.y; })
        .attr("x2", function(d) { return d.target.x; })
        .attr("y2", function(d) { return d.target.y; });
      });
      var dragger = d3.behavior.drag().on("drag", dragFn);
      function dragFn(d) {
      d3.select(this).attr("cx", d.x = d3.event.x).attr("cy", d.y = d3.event.y);
      force.start();
      }
      circles.call(dragger);

      force.start();

      </script>
  </body>
</html>

Add a minimal draggable force-directect layout example
Add a minimal draggable force-directect layout example
