Testing how a Sankey with circular links may be constructed.
This chart detects circular links, and then uses top and bottom 'channels' to layout those links back to the target node. The middle channel is for "forward" links through the process.
This needs more work in terms in aligning the nodes better - the nodes which have circular links are pushed to the top or bottom, but perhaps a bit too rigourously.
This version of the sankey code works out padding based on a proportion of the height and max values/nodes in each column.
Need to consider how circular links could work going down the middle if that makes sense, eg from process4 to process1 in this example. Perhaps if the nodes a close in terms of depth, and the risk of crossing other links is lower?
But ultimately, this needs a load more sankey datasets thrown at it, to break the layout functions
forked from tomshanley's block: Sankey with circular links
https://d3js.org/d3.v4.min.js
https://d3js.org/d3-scale-chromatic.v1.min.js