[d3-sankey] Throw an error for graphs with cycles
The current behaviour is to go into an infinite loop while trying to assign depths to nodes in case the graph has cycles. This commit changes it to explicitly throw an error instead till displaying cycles in sankeys is properly supported.
Tested by modifying http://bost.ocks.org/mike/sankey/ data to have complex cycles and attempting to render.
This patch uses a hashtable to check if nodes have already been seen, and this uses the node name as a key. However, the node name is probably not necessarily unique.
There is a similar situation in #105 (already merged), and there a list is used instead. Slower lookup, but proper node identity.
(FYI: I started a friendly (subtree) fork (see #133) of the sankey plugin at https://github.com/soxofaan/d3-plugin-captain-sankey)
This issue is handled by soxofaan/d3-plugin-captain-sankey#4 Work on supporting rendering cycles is at soxofaan/d3-plugin-captain-sankey#6