title: D3.js force directed graph, reduce edge crossings by making edges repel each other
body: <p>So i have a page already which draws a force directed graph, like the one shown <a href="http://networkx.lanl.gov/" rel="noreferrer">here</a>.</p>
  
  <p>And that works fine. I'm using the JS from <a href="http://mbostock.github.com/d3/ex/force.html" rel="noreferrer">here</a>, with a few tweaks to spread out the nodes slightly nicer.</p>
  
  <p>These are more or less the only differences:</p>
  
  <pre><code>d3.json("force.json", function(json) {
    var force = d3.layout.force()
        .gravity(0.1)
        .charge(-2000)
        .linkDistance(1)
        .linkStrength(0.1)
        .nodes(json.nodes)
        .links(json.links)
        .size([w, h])
        .start();
  </code></pre>
  
  <p>Where reducing the link strength seems to make the links more like springs, so it becomes similar to the <a href="http://en.wikipedia.org/wiki/Force-based_algorithms_%28graph_drawing%29" rel="noreferrer">Fruchterman &amp; Reingold</a> technique often used. This works reasonably well, but only for fairly small graphs. With larger graphs the number of crossings just goes up - as one would expect, but the solution it lands on is normally far from optimal. I'm not looking for a method to get the optimal solution, I know that's very difficult. I would just like it to have some crude addition that tries to force the lines apart as well as the nodes.</p>
  
  <p><strong>Is there a way to add a repulsion between in links, as well as between the nodes?</strong> I'm not familiar with the way D3 force works, and i can't seem to find anything that says this is possible...</p>