title: D3.js constructing links from nodes?
body: <p><a href="http://bl.ocks.org/mbostock/1062288" rel="nofollow">I am referring to example shown there</a>.</p>
  
  <p>I can not understand how d3.js creates links from nodes. Let me explain what I understand:
  We have a root that js object read from file representing json; We get nodes recursively and give ids.
  But then occurs part that I dont understand. How d3.layout.tree().links function returns links? We only pass nodes to function, that is just ids, and coordinates of nodes?</p>
  
  <pre><code>    d3.json("graph.json", function(error, json) {
      root = json;
      update();
      });
      function update() {
      var nodes = flatten(root), 
      links = d3.layout.tree().links(nodes);
  </code></pre>