Release v0.1.3: fix sibling edges crossing from a shared source - #6
Merged
Conversation
Bump workspace crates to 0.1.2 and publish the fixes landed since 0.1.1: - Fix overlapping parallel edges between same node pair (#3) - Fix flaky test_unique_id: make ID counter thread-local (#4) Update inter-crate dependency pins (mermaid-core -> mermaid-dagre, mermaid-rs-cli -> mermaid-core) to 0.1.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Edges fanning out from a single source to multiple targets in a lower rank could cross each other when dagre's ordering pass placed their interior waypoint columns (subgraph-border / long-edge dummy nodes) in an order inconsistent with the targets' positions. The most visible case: a node inside a subgraph with edges to several outside nodes, where the edge to a far node is routed through an inner lane while the edge to a nearer node bulges past it, so the two cross before reaching their destinations. This is inherited dagre behavior; upstream mermaid.js exhibits it too. Add a deterministic post-layout pass, reorder_sibling_waypoints, that re-lanes such edges: - Edges are bundled by (source, interior rank-set). Only edges that traverse an identical set of ranks are re-laned together, so a long edge that legitimately detours through extra ranks stays in its own bundle and is never pulled off its route. - Within a bundle, the existing lane positions are reassigned to edges in the order of their targets' cross-axis position. The set of lanes is preserved exactly (only the assignment is permuted), so dagre's spacing is kept and the pass can only remove crossings, never collide edges. - Ties on the target coordinate (parallel edges to the same node) keep their current lanes, preserving the parallel-edge separation from #3. - Endpoints are recomputed as border intersections toward the relocated adjacent waypoint so each edge still meets its node cleanly. Covered by five unit tests: the swap case, no-op when already ordered, parallel-edge preservation, divergent long-edge isolation, and the horizontal-layout axis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump workspace crates to 0.1.3 and publish the fix landed since 0.1.2: - Fix sibling edges crossing when fanning out from a shared source (#5) Update inter-crate dependency pins (mermaid-core -> mermaid-dagre, mermaid-rs-cli -> mermaid-core) to 0.1.3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Cuts v0.1.3, shipping a flowchart edge-routing fix.
Edges fanning out from a single source to multiple targets in a lower rank could cross each other when dagre's ordering pass placed their interior waypoint columns (subgraph-border / long-edge dummy nodes) in an order inconsistent with the targets' positions. Most visible case: a node inside a subgraph with edges to several outside nodes, where the edge to a far node routes through an inner lane while the edge to a nearer node bulges past it, so the two cross before reaching their destinations. This is inherited dagre behavior; upstream mermaid.js exhibits it too.
Fix
A deterministic post-layout pass,
reorder_sibling_waypoints, re-lanes such edges:(source, interior rank-set). Only edges traversing an identical set of ranks are re-laned together, so a long edge that legitimately detours through extra ranks stays in its own bundle and is never pulled off its route.Tests
Five new unit tests (swap, no-op-when-ordered, parallel-edge preservation, divergent long-edge isolation, horizontal-layout axis). Full suite passes: 973 lib + 92 integration. Clippy clean.
Version bump
Workspace crates 0.1.2 -> 0.1.3 and inter-crate dependency pins updated, matching the established release pattern.