Vertically sort each subset of branches in D3 Sankey diagram
<p>JSFiddle example: <a href="http://jsfiddle.net/zpgt1aq0/3/" rel="nofollow noreferrer">http://jsfiddle.net/zpgt1aq0/3/</a></p>

<p>I'd like to order the nodes in my sankey diagram by value for each "column" of the diagram. </p>

<p>Here is an example of the ordering I'd like to display (created manually for the time being): 
<a href="https://i.stack.imgur.com/UMkWG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UMkWG.png" alt="Sorted Sankey example"></a> </p>

<p>However, this is what the default sort gives me:
<a href="https://i.stack.imgur.com/cr8he.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cr8he.png" alt="enter image description here"></a></p>

<p>Some researching led me to the following two questions:</p>

<p><a href="https://stackoverflow.com/questions/27121764/how-to-force-y-position-of-one-branch-in-d3-sankey-plugin">How to force y position of one branch in d3 sankey plugin?</a></p>

<p><a href="https://stackoverflow.com/questions/32777116/vertical-sort-of-nodes-in-d3-sankey-diagram">Vertical sort of nodes in D3 Sankey diagram</a></p>

<p>but neither of these are exactly what I'm looking for. </p>

<p>I imagine this has to do with a combination of the <code>ascendingDepth()</code> function and the <code>removeCollisions()</code> piece of the <code>computeNodeDepths()</code> function, but I can't seem to wrap my head around how to proceed. </p>