Module
LayeredLayout.EdgeRouting.HyperEdges
- Package
- purescript-layered-layout
- Repository
- markgrafhq/purescript-layered-layout
Port of OrthogonalRoutingGenerator hyperedge segment construction
and slot assignment.
Pipeline (matching ELK):
- Group edges by (sourceNode, sourcePort) per gap → segments.
- For every segment pair compute crossings + conflicts and add a
directed
HyperEdgeSegmentDependency. Penalties: CONFLICT_PENALTY=1, CROSSING_PENALTY=16. Two thresholds: regular conflictThreshold (0.5 * edgeSpacing) marks a non-critical conflict; the smaller criticalConflictThreshold (0.2 * minimumHorizontalSegmentDistance) marks a CRITICAL conflict — both orderings would force overlap. breakCriticalCycles: run cycle detection on CRITICAL deps only; feed the leftward criticals tosplitSegments(port ofHyperEdgeSegmentSplitter). Splitting cuts a segment into two parts joined through a free area, regenerating the deps for the new segments.breakNonCriticalCycles: run the Eades-Lin-Smyth feedback-arc-set heuristic over the full dep graph; reverse leftward regular deps and remove zero-weight ones.- Topologically number the resulting DAG into routing slots
(
OrthogonalRoutingGenerator.topologicalNumbering).
The slot index drives each edge's horizontal-trunk y via
y = gapTop + edgeNodeBetweenLayers
+ slot * edgeEdgeBetweenLayers
#assignSlots Source
assignSlots :: Random -> Array PortAssignment -> Array NodePlacement -> { random :: Random, slots :: Map EdgeId SlotInfo }#slotCountByGap Source
slotCountByGap :: Map EdgeId SlotInfo -> Map Int IntPer-gap routing-slot count, keyed by gap index. The slot count
is OrthogonalRoutingGenerator.routeEdges's rankCount + 1:
the number of distinct horizontal routing channels the orthogonal
router will need in that gap. Straight pass-through segments
don't add a rank, but every segment with a horizontal trunk does.
Read the channel counts from an existing plan. Gap sizing and routing
- Modules
- LayeredLayout
- LayeredLayout.
Aesthetics - LayeredLayout.
Compaction. EdgeAwareScanlineConstraints - LayeredLayout.
Compaction. HorizontalGraphCompactor - LayeredLayout.
Compaction. LGraphToCGraphTransformer - LayeredLayout.
Compaction. NetworkSimplexCompaction - LayeredLayout.
Compaction. OneD - LayeredLayout.
Compaction. VerticalSegment - LayeredLayout.
Components - LayeredLayout.
CoordAssignment - LayeredLayout.
CrossingMin - LayeredLayout.
CrossingMin. Constraints - LayeredLayout.
CrossingMin. NorthSouth - LayeredLayout.
CrossingMin. Ports - LayeredLayout.
CycleRemoval - LayeredLayout.
DummyNodes - LayeredLayout.
EdgeLabels - LayeredLayout.
EdgeLabels. SelfLoops - LayeredLayout.
EdgeLabels. SelfLoops. Model - LayeredLayout.
EdgeLabels. SelfLoops. Routing - LayeredLayout.
EdgeRouting - LayeredLayout.
EdgeRouting. HyperEdgeCycleDetector - LayeredLayout.
EdgeRouting. HyperEdges - LayeredLayout.
EdgeRouting. LineJump - LayeredLayout.
EdgeRouting. Orthogonal - LayeredLayout.
EdgeRouting. PortAssignment - LayeredLayout.
Graph - LayeredLayout.
Grid - LayeredLayout.
JavaRandom - LayeredLayout.
LayerAssignment - LayeredLayout.
LayerAssignment. NetworkSimplex - LayeredLayout.
NetworkSimplex - LayeredLayout.
PortDistribution - LayeredLayout.
PortDummies - LayeredLayout.
Result