Repository navigation
MudChart: Fix Sankey hang on circular edge definitions - #13322
Merged
danielchalmers merged 1 commit intoJun 19, 2026
Merged
Conversation
Sankey's CalculateNodeColumns ran a BFS that always re-enqueued every target to find the longest path. With circular edges (e.g. A->B, B->A) no node is a root, so the source-node fallback treats every node as a source and the column keeps increasing on each pass around the cycle. The queue never drains and the render hangs. Only enqueue a target when the edge pushes it into a deeper column, and cap the column at the node count (the longest path in a graph of N nodes spans at most N-1 edges). This terminates on cyclic input while producing identical columns for valid acyclic graphs. Adds a regression test rendering a two-node cycle.
This was referenced Jun 27, 2026
Merged
This was referenced Sep 17, 2026
This was referenced Sep 28, 2026
This was referenced Oct 8, 2026
This was referenced Oct 15, 2026
This was referenced Oct 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Sankey chart whose edges form a cycle (e.g.
A -> B,B -> A) hangs the render.Sankey.CalculateNodeColumnsruns a BFS that always re-enqueues every target to find the longest path. With a cycle there is no root node, so the source-node fallback treats every node as a source and each pass around the cycle increases the column — the queue never drains and rendering loops forever.The fix is to only enqueue a target when the edge actually pushes it into a deeper column and cap the column at the node count (the longest path in a graph of
Nnodes spans at mostN-1edges). This terminates on cyclic input while producing identical columns for valid acyclic graphs, so existing layout behaviour is unchanged.Checklist: