d3-plugins icon indicating copy to clipboard operation
d3-plugins copied to clipboard

[d3-sankey] Throw an error for graphs with cycles

Open kunalb opened this issue 12 years ago • 2 comments

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.

kunalb avatar Sep 22 '13 06:09 kunalb

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.

thiloplanz avatar Dec 17 '14 09:12 thiloplanz

(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

soxofaan avatar Jun 22 '15 12:06 soxofaan