More advanced checking for cycles. The cycles are broken in a random fashion: this could be done more intelligently, but at least for now the Sankey won't crash the browser anymore.