Repository navigation
Route cross-hierarchy edges to nested endpoint nodes - #47
Merged
Merged
Conversation
…auto Fixes AutoLayoutAlgorithm dropping root-declared edges whose endpoints are nested in different containers (closes #45). Edges declared in an ancestor graph are now routed from the actual nested source node to the actual nested target node, and ancestor placement accounts for them via layout-only proxy edges (closes #46). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Two critical active findings remain: valid public edge IDs can be misclassified as internal proxies, and parallel-edge deduplication can discard the real connector when a layout-only edge is retained.
2 open issues
What changed in this PR
Adds end-to-end support for routing edges declared on ancestor graphs to their actual nested endpoint nodes, while preserving separate child layout and avoiding unrelated boxes.
Changes:
- Routes cross-hierarchy edges with per-connection obstacles, nested endpoint anchoring, title-band avoidance, anchor separation, and lane handling.
- Adds layout-only proxy edges so ancestor placement accounts for nested connections without emitting duplicate connectors.
- Improves automatic connectivity detection and packed box ordering, with expanded tests, documentation, requirements traceability, roadmap notes, and gallery diagrams.
| File | Description |
|---|---|
| test/DemaConsulting.Rendering.Layout.Tests/LayeredLayoutAlgorithmTests.cs | Tests layout-only edge layering and emission behavior. |
| test/DemaConsulting.Rendering.Layout.Tests/HierarchicalLayoutAlgorithmTests.cs | Adds cross-hierarchy routing, placement, determinism, and compatibility coverage. |
| test/DemaConsulting.Rendering.Layout.Tests/ContainmentLayoutAlgorithmTests.cs | Tests layout-only corridor widening without drawing proxy lines. |
| test/DemaConsulting.Rendering.Layout.Tests/ConnectorRouterTests.cs | Tests per-connection obstacles, fixed anchors, and nested-wall routing. |
| test/DemaConsulting.Rendering.Layout.Tests/AutoLayoutAlgorithmTests.cs | Tests nested endpoint connectivity and input-order preservation. |
| test/DemaConsulting.Rendering.Gallery/GalleryShowcaseTests.cs | Generates the new cross-hierarchy gallery diagrams. |
| test/DemaConsulting.Rendering.Gallery/GalleryDiagrams.cs | Defines cross-hierarchy examples and strengthens the obstacle showcase. |
| test/DemaConsulting.Rendering.Gallery/GalleryCatalog.cs | Registers the new gallery images and descriptions. |
| src/DemaConsulting.Rendering/Options/HierarchyHandling.cs | Documents nested endpoint routing as the default separate-children behavior. |
| src/DemaConsulting.Rendering/Graph/LayoutGraph.cs | Updates the graph contract for ancestor-declared nested edges. |
| src/DemaConsulting.Rendering.Layout/LayeredLayoutAlgorithm.cs | Makes layout-only edges influence placement without emitting connectors. |
| src/DemaConsulting.Rendering.Layout/HierarchicalLayoutAlgorithm.cs | Adds proxy placement edges, nested endpoint resolution, obstacle expansion, and cross-hierarchy routing. |
| src/DemaConsulting.Rendering.Layout/ContainmentLayoutAlgorithm.cs | Accounts for layout-only edges during corridor sizing while suppressing their output. |
| src/DemaConsulting.Rendering.Layout/ConnectorRouter.cs | Adds internal per-connection obstacle routing and fixed-anchor separation. |
| src/DemaConsulting.Rendering.Layout/AutoLayoutAlgorithm.cs | Maps nested endpoints for connectivity and restores packed boxes to input order. |
| ROADMAP.md | Clarifies delivered cross-hierarchy routing versus future include-children behavior. |
| README.md | Documents nested endpoint routing in the feature overview. |
| docs/verification/rendering-layout/layered-layout-algorithm.md | Registers layout-only edge verification coverage. |
| docs/verification/rendering-layout/hierarchical-layout-algorithm.md | Documents cross-hierarchy routing and placement verification. |
| docs/verification/rendering-layout/containment-layout-algorithm.md | Documents layout-only edge corridor verification. |
| docs/verification/rendering-layout/connector-router.md | Documents internal batch-router verification. |
| docs/verification/rendering-layout/auto-layout-algorithm.md | Documents nested connectivity and box-order verification. |
| docs/user_guide/introduction.md | Explains ancestor-declared nested edge routing and lists its limitations. |
| docs/reqstream/rendering-layout/layered-layout-algorithm.yaml | Adds layout-only edge requirements and test traceability. |
| docs/reqstream/rendering-layout/hierarchical-layout-algorithm.yaml | Adds nested-anchor, placement, and same-container requirements. |
| docs/reqstream/rendering-layout/containment-layout-algorithm.yaml | Adds layout-only corridor requirements. |
| docs/reqstream/rendering-layout/auto-layout-algorithm.yaml | Adds nested connectivity and input-order requirements. |
| docs/reqstream/rendering-layout.yaml | Links the new requirements into the rendering layout requirement set. |
| docs/gallery/parallel-edges-and-ports/hierarchical-parallel-edges-side-by-side.svg | Refreshes generated parallel-edge gallery output. |
| docs/gallery/nested-hierarchy/README.md | Documents the cross-hierarchy gallery examples. |
| docs/gallery/nested-hierarchy/hierarchical-nested.svg | Refreshes nested hierarchical output for the new routing behavior. |
| docs/gallery/nested-hierarchy/cross-hierarchy-edges.svg | Adds the auto-layout cross-hierarchy example. |
| docs/gallery/nested-hierarchy/cross-hierarchy-edges-hierarchical.svg | Adds the hierarchical cross-hierarchy example. |
| docs/gallery/nested-hierarchy/auto-deep-nested-mixed-connectivity.svg | Refreshes generated auto-layout output. |
| docs/gallery/flow-pipeline/orthogonal-obstacle.svg | Refreshes the obstacle-routing showcase with explicit intervening edges. |
| docs/gallery/connectivity-and-clusters/auto-multiple-disconnected-clusters.svg | Refreshes generated disconnected-cluster output. |
| docs/gallery/connectivity-and-clusters/auto-cluster-plus-isolated.svg | Refreshes generated cluster-plus-isolated output. |
| docs/design/rendering/options.md | Updates hierarchy-handling design documentation. |
| docs/design/rendering/layout-graph.md | Documents ancestor-declared nested edge semantics. |
| docs/design/rendering-layout/layered-layout-algorithm.md | Documents layout-only edge processing. |
| docs/design/rendering-layout/hierarchical-layout-algorithm.md | Describes nested endpoint resolution, proxy placement, and routing. |
| docs/design/rendering-layout/containment-layout-algorithm.md | Describes layout-only edge handling in containment packing. |
| docs/design/rendering-layout/connector-router.md | Documents the internal per-connection routing entry point. |
| docs/design/rendering-layout/auto-layout-algorithm.md | Documents nested component detection and input-order restoration. |
| docs/design/rendering-layout.md | Updates the overall layout subsystem architecture description. |
Review effort: Lite
Layout-only proxy edges are no longer identified by an edge-ID prefix (a user edge with such an ID was silently dropped); they are tracked by object identity and carried through component copying. LayeredLayoutAlgorithm now orders real edges before layout-only ones so CycleBreaker's parallel-edge dedup always retains a real edge (MergeParallelEdges=true). Addresses review comments on #47. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ll keep-out Router now slides ports along faces to align with the corridor lane (straight connector when possible), keeps decoration within the face (derived corner margin), enforces minimum interior segments and end legs, keeps >=24px from container borders when running parallel, and uses a cross-hierarchy profile (adjacent-face choice, peer arrowhead zones, crossing penalty) for nested edges. Gallery: orthogonal-obstacle, cross-hierarchy-edges (Storage/API declaration order swapped to avoid a planarity-forced crossing) and cross-hierarchy-edges-hierarchical re-rendered. Addresses PR #47 review (closes #45, closes #46). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 13, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The changes span hierarchy composition, auto-packing, and orthogonal routing across interacting algorithms, while required build, test, runtime, and visual-routing validation could not be completed.
No open issues 🎉
2 resolved since last review
Review effort: Lite
This was referenced Nov 15, 2026
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.


Pull Request
Description
Adds end-to-end support for cross-hierarchy edges: edges declared in an ancestor graph whose endpoints are nested nodes.
AutoLayoutAlgorithmnow maps nested endpoints to their top-level ancestor when detecting components, so edges between nodes in different containers are kept and routed. A related bug is also fixed: the multi-groupPackreturned boxes in group order instead of input order, which could attach a container's children to the wrong box.autoandhierarchicalroots. This is the default behavior; no newHierarchyHandlingvalue was added, and the "IncludeChildren planned" note was removed.ConnectorRouteroverload uses a per-edge obstacle set, so routes pass through the endpoints' own containers but not through unrelated boxes.MergeParallelEdges = true.Behavior change: cross-hierarchy edges previously anchored on container boxes now anchor on the nested endpoint nodes. There are no public API changes.
Before / After
Each pair renders the identical gallery graph from
GalleryDiagrams.cswithThemes.Darkand the same options, usingmain(left) and this PR at6f95f25(right).Cross-hierarchy edges,
autoroot (#45, #46). Before, the cross-container edges were dropped and the two folders were stacked as unrelated components. After, UI→DB, Auth→Storage and Session→API are routed to the nested nodes.Cross-hierarchy edges,
hierarchicalroot. Before, boxes overlapped and edges were tangled. After, the containers are laid out in clean bands, with orthogonal edges ending on the nested nodes.Orthogonal obstacle. The Source→Sink edge is now routed around Obstacle between the nested nodes, with long straight approaches at both ends.
Hierarchical nested. The edge now goes directly into the nested API node instead of ending on the Service container.
Type of Change
Related Issues
Closes #45
Closes #46
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
pwsh ./build.ps1. Passed: 3555/3555 tests at6f95f25, across all target frameworks including net481.Code Quality
Quality Checks
pwsh ./lint.ps1. Passed.Testing
Documentation
cross-hierarchy-edges.svg(auto) andcross-hierarchy-edges-hierarchical.svg.Additional Notes
main.hierarchical-nested, the threetheme-*images,hierarchical-parallel-edges-side-by-side, andorthogonal-obstacle.auto-*images.GalleryDiagrams.CrossHierarchyEdges()was swapped because the placement forced an edge crossing that routing cannot avoid. Crossing minimization across containers is tracked separately.