On d3's Sankey Diagram page, Mike Bostock says: โThe algorithm may be improved in the future, say, to minimize link crosses.โ
I would like to spend some time and do just that, but I'm not sure what will begin. Does anyone have any suggestions or ideas on how to achieve this?
My intuition is that iterative relaxation applied to nodes to minimize distances between lines can also be used to move the same nodes to minimize channel crossings.
I really need to โdistributeโ nodes vertically even in situations where there is only one node per x-position, so that link intersections are greatly reduced (this does not have to be an academic -level result, practical, better than it is -right-now-the result will be enough)
Here's a JS Fiddle as a starting point - with nodes located on a sub-optimal path that makes edges / links intersect from the start:
function getData() { return { "nodes": [{ "node": 0, "name": "Name0" }, { "node": 1, "name": "Name1" }, { "node": 2, "name": "Action2" }, { "node": 3, "name": "Name3" }, { "node": 4, "name": "Name4" }, { "node": 5, "name": "Action5" }, { "node": 6, "name": "Action6" }, { "node": 7, "name": "Action7" }, { "node": 8, "name": "Action8" }], "links": [{ "source": 0, "target": 6, "value": 25, "id": "name0" }, { "source": 1, "target": 2, "value": 25, "id": "Name1" }, { "source": 2, "target": 5, "value": 25, "id": "Name1" }, { "source": 3, "target": 6, "value": 25, "id": "Name3" }, { "source": 6, "target": 7, "value": 25, "id": "name0" }, { "source": 4, "target": 7, "value": 25, "id": "Name4" }, { "source": 5, "target": 7, "value": 25, "id": "Name1" }, { "source": 6, "target": 7, "value": 25, "id": "Name3", }, { "source": 7, "target": 8, "value": 25, "id": "Name3" }] }; }