title: Custom link widths based on depth or parent radius
body: <p>I have been trying to chase this problem for quite some time. I am trying to adjust the width of an edge based on either the radius of the parent or the depth of the child. Ideally I would like to do it by referencing the parent/source radius. The most promising option has been to create a function for the stroke width:</p>
  
  <pre><code>.attr("stroke-width",  function(d) { return d.r ;}); 
  </code></pre>
  
  <p>The result is the image below in which one edge is given the desired edge and the rest are different. Is there another method that can be suggested?</p>
  
  <p>Lars Kotthoff suggested the following, but the results are essentially the same:</p>
  
  <pre><code>function(d) { return (d.children ? d.children[0].r : d.r)/600; }
  </code></pre>
  
  <p>Another option is referencing d.depth but this produces the same results.</p>
  
  <p><img src="https://i.stack.imgur.com/ZN1Ge.jpg" alt="enter image description here"></p>
  
  <p>When I set the width to d.depth, unusual numbers are returned that do not correspond to the depth. The first edge returns a width of 0, the second returns 1, the third returns 2, and the fourth returns 2 again. There seems to be no rhyme or reason.</p>
  
  <pre><code>    .attr("stroke-width", function(d) { return d.depth});
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/FXQc0.jpg" alt="enter image description here"></p>