d3/d3-plugins — pull request #39 by kunalb (2013-01-28 20:10:14+00:00)
Title: Add support for self-loops and cycles in sankeys

- Changes the logic of assigning breadths to first break the graph down into strongly connected components, layer out the resulting DAG the same way the current algo lays out nodes; then do a bfs from the obtained `root` of each SCC and lay out cycle members.

- There are very weird artefacts at the endpoints of splines for wide splines, so I ended up replacing links with 2 splines to define the structure explicitly. Fill isn't as good as I want it to be, but I'm not sure about the best way to proceed.

Sample using existing data, and with a loop: http://bl.ocks.org/d/4658510/

The code is a bit rough -- I was mainly iterating to get something that looked decent first, can/will clean up as required.