Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kunalb
Copy link

@kunalb kunalb commented Sep 22, 2013

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.

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 support for 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.
@thiloplanz
Copy link

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.

@soxofaan
Copy link

(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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants