spice2wireviz/examples/hierarchical.yml
Ryan Malloy b8ff2d19da Add Sugiyama-lite layout optimization for inter-module diagrams
Layered graph drawing approach to minimize cable crossings:
- Layer assignment via BFS from external connectors (J*, TP*, P*)
- Barycenter ordering (forward + backward sweep) within each layer
- Connection orientation: earlier connector always on the left
- Pin reordering: weighted average neighbor position groups pins
  by destination, reducing within-connector crossings
- Connection sorting: shorter (adjacent-pair) connections first

Fixes from Apollo safety review:
- Explicit ValueError on pin remapping failures (was silent KeyError)
- Weighted pin averaging for star topology (GND shared across modules)
- Fully deterministic sort keys for reproducible output
- Documented closure capture pattern in loop sort keys
2026-02-13 02:01:06 -07:00

161 lines
2.2 KiB
YAML

metadata:
title: 'Wiring diagram: hierarchical'
source: tests/fixtures/hierarchical.net
generator: spice2wireviz 2026.2.13
connectors:
J_PWR:
type: BARREL_JACK
pinlabels:
- VIN_RAW
- GND
notes: 'SPICE ref: J_PWR'
TP_3V3:
type: TP
style: simple
pinlabels:
- V3V3
notes: 'SPICE ref: TP_3V3'
J_USB:
type: USB_B_CONN
pinlabels:
- GND
- USB_DP
- USB_DM
notes: 'SPICE ref: J_USB'
X_REG:
type: regulator
pinlabels:
- VIN
- GND
- VOUT
notes: 'SPICE instance: X_REG (regulator)'
X_MAIN:
type: main_board
pinlabels:
- USB_D+
- USB_D-
- VCC
- GND
- SDA
- SCL
- ALERT
notes: 'SPICE instance: X_MAIN (main_board)'
X_SENSOR:
type: sensor_module
pinlabels:
- VCC
- GND
- SDA
- SCL
- ALERT
notes: 'SPICE instance: X_SENSOR (sensor_module)'
cables:
W1:
category: bundle
colors:
- BK
- ''
wirelabels:
- GND
- VIN_RAW
notes: 'Nets: GND, VIN_RAW'
W2:
category: bundle
wirecount: 2
wirelabels:
- USB_DM
- USB_DP
notes: 'Nets: USB_DM, USB_DP'
W3:
colors:
- BK
wirelabels:
- GND
notes: 'Net: GND'
W5:
wirecount: 1
wirelabels:
- V3V3
notes: 'Net: V3V3'
W7:
category: bundle
colors:
- BK
- ''
wirelabels:
- GND
- V3V3
notes: 'Nets: GND, V3V3'
W8:
category: bundle
wirecount: 3
wirelabels:
- ALERT_SIG
- I2C_SCL
- I2C_SDA
notes: 'Nets: ALERT_SIG, I2C_SCL, I2C_SDA'
W9:
category: bundle
colors:
- BK
- ''
wirelabels:
- GND
- V3V3
notes: 'Nets: GND, V3V3'
connections:
- - J_USB: 1
- W3: 1
- X_REG: 2
- - X_REG:
- 2
- 3
- W7:
- 1
- 2
- X_MAIN:
- 4
- 3
- - X_MAIN:
- 7
- 6
- 5
- W8:
- 1
- 2
- 3
- X_SENSOR:
- 5
- 4
- 3
- - TP_3V3: 1
- W5: 1
- X_REG: 3
- - J_USB:
- 3
- 2
- W2:
- 1
- 2
- X_MAIN:
- 2
- 1
- - X_REG:
- 2
- 3
- W9:
- 1
- 2
- X_SENSOR:
- 2
- 1
- - J_PWR:
- 2
- 1
- W1:
- 1
- 2
- X_REG:
- 2
- 1