Skip to content

Release v0.1.3: fix sibling edges crossing from a shared source - #6

Merged
cmwright merged 3 commits into
mainfrom
release/v0.1.3
Jun 9, 2026
Merged

Release v0.1.3: fix sibling edges crossing from a shared source#6
cmwright merged 3 commits into
mainfrom
release/v0.1.3

Conversation

@cmwright

@cmwright cmwright commented Jun 9, 2026

Copy link
Copy Markdown
Owner

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:

  • Edges are bundled by (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.
  • Within a bundle, the existing lane positions are reassigned to edges in order of their targets' cross-axis position. The lane set 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 lanes, preserving the parallel-edge separation from Fix overlapping parallel edges between same node pair #3.
  • Endpoints are recomputed as border intersections toward the relocated adjacent waypoint.

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.

cmwright and others added 3 commits June 9, 2026 15:23
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>
@cmwright
cmwright merged commit 0319f0a into main Jun 9, 2026
1 check passed
@cmwright
cmwright deleted the release/v0.1.3 branch June 9, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant