d3js tree.nodes() is not a function
<p>While the below piece of code works find in d3v3, it fails in v4.</p>

<pre><code> var nodes = tree.nodes(root).reverse(),
      links = tree.links(nodes);
</code></pre>

<blockquote>
  <p>Uncaught TypeError: tree.nodes is not a function</p>
</blockquote>

<p>What is the alternative for it in v4?</p>