Fix overlapping parallel edges between same node pair - #3
Merged
Conversation
Parallel edges between the same (from, to) node pair were drawn on top of each other because every edge was registered with dagre under a `None` name, collapsing them to a single edge ID in the multigraph. Downstream extraction and routing maps were keyed only by (from, to), so both edges shared one routing path and one label position. Thread a per-edge identity (the edge's positional index, stable because `all_edges` is shared in identical order between graph_builder and route_edges) through the pipeline: - graph_builder: assign each edge a unique dagre name so the multigraph and normalize step give each parallel edge its own dummy chain. - types: add EdgeKey = (String, String, Option<String>). - mod: key DagreEdgeExtraction maps by EdgeKey; retain-by-pair cleanup. - edge_routing: reconstruct the matching key when routing. Add a regression test asserting parallel wait2->review edges get distinct label positions and distinct routed paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
cmwright
added a commit
that referenced
this pull request
Jun 9, 2026
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>
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.
Problem
Parallel edges between the same
(from, to)node pair were drawn on top of each other. In the reported vendor-onboarding flowchart, the twoKeep waiting → Analyst review approval gateedges (submitted/window lapses) overlapped completely, where mermaid.js splits them into two separate curves.Root cause
Every edge was registered with dagre under a
Nonename, so parallel edges collapsed to a single edge ID in the multigraph — the second overwrote the first. Downstream extraction and routing maps were keyed only by(from, to), so both edges shared one routing path and one label position.Fix
Thread a per-edge identity (the edge's positional index — stable because
all_edgesis iterated in identical order by bothgraph_builderandroute_edges) through the pipeline:normalizestep give each parallel edge its own dummy chain (distinct routing and label-dummy positions).EdgeKey = (String, String, Option<String>).DagreEdgeExtractionmaps byEdgeKey; subgraph-fallback cleanup retains by node pair regardless of name.Edge names survive dagre's acyclic reversal (restored via
forward_nameon undo), so keys stay consistent after layout.Testing
test_parallel_edges_are_separatedasserting the two parallelwait2 → reviewedges get distinct label positions and distinct routed paths.🤖 Generated with Claude Code