qlinks architecture diagnosis
d72a152ca082Package dependency overview
Arrows point from a package to the package it imports. Vertical placement follows dependency depth, so lower nodes tend to be architectural foundations. Edge thickness represents the number of resolved internal import references.
Click a package to highlight its immediate dependencies and dependents. Click empty graph space to reset.
Module explorer
Use this view for targeted diagnosis inside one top-level package. This keeps the report readable even when the repository has hundreds of modules.
Package metrics
| Package | Files | Lines | Fan-in | Fan-out | Imports in | Imports out |
|---|---|---|---|---|---|---|
| qlinks.caging | 46 | 40120 | 4 | 8 | 5 | 25 |
| qlinks.open_system | 20 | 24980 | 0 | 5 | 0 | 34 |
| qlinks.visualizer | 7 | 10764 | 0 | 3 | 0 | 5 |
| qlinks.models | 10 | 5107 | 3 | 9 | 12 | 37 |
| qlinks.qec | 10 | 4693 | 0 | 6 | 0 | 15 |
| qlinks.constraints | 11 | 3480 | 3 | 2 | 13 | 15 |
| qlinks.operators | 11 | 3053 | 4 | 3 | 14 | 16 |
| qlinks.basis | 9 | 2031 | 7 | 2 | 20 | 9 |
| qlinks.lattice | 8 | 1985 | 7 | 0 | 25 | 0 |
| qlinks.encoded | 5 | 1691 | 4 | 5 | 11 | 8 |
| qlinks.io | 3 | 829 | 0 | 1 | 0 | 1 |
| qlinks.builders | 4 | 718 | 2 | 3 | 2 | 6 |
| qlinks.variables | 5 | 655 | 8 | 0 | 40 | 0 |
| qlinks.local_structure | 4 | 551 | 2 | 0 | 25 | 0 |
| qlinks.distributed | 1 | 274 | 0 | 0 | 0 | 0 |
| qlinks.backends | 2 | 224 | 3 | 0 | 4 | 0 |
| qlinks.conventions | 2 | 105 | 1 | 1 | 1 | 1 |
| qlinks | 1 | 28 | 0 | 0 | 0 | 0 |
| qlinks.exceptions | 1 | 17 | 0 | 0 | 0 | 0 |
Coupling hotspots
Highest fan-out
| Module | Fan-out | Import refs | Lines |
|---|---|---|---|
| qlinks.caging | 35 | 35 | 1059 |
| qlinks.open_system | 13 | 13 | 311 |
| qlinks.open_system.constructions.cage_lindblad | 13 | 13 | 3328 |
| qlinks.open_system.constructions.deprecated.cage | 13 | 13 | 4365 |
| qlinks.caging.local_search | 10 | 10 | 195 |
| qlinks.constraints | 10 | 10 | 97 |
| qlinks.models.qlm | 10 | 10 | 1200 |
| qlinks.operators | 10 | 10 | 117 |
| qlinks.caging.local_search_qdm | 9 | 9 | 584 |
| qlinks.models | 9 | 9 | 118 |
| qlinks.caging.stability | 8 | 14 | 171 |
| qlinks.qec.profile | 8 | 14 | 736 |
| qlinks.qec.sector_matching | 8 | 11 | 710 |
| qlinks.caging.local_search_certification | 8 | 8 | 1124 |
| qlinks.caging.stability_qdm | 8 | 8 | 1691 |
Highest fan-in
| Module | Fan-in | Import refs | Lines |
|---|---|---|---|
| qlinks.variables | 40 | 40 | 23 |
| qlinks.lattice | 25 | 25 | 37 |
| qlinks.basis | 21 | 21 | 49 |
| qlinks.caging.local_search_types | 15 | 15 | 1749 |
| qlinks.constraints | 12 | 12 | 97 |
| qlinks.caging.nullspace | 11 | 11 | 86 |
| qlinks.operators | 11 | 11 | 117 |
| qlinks.constraints.base | 10 | 10 | 267 |
| qlinks.models.base | 10 | 10 | 970 |
| qlinks.caging.candidate | 9 | 9 | 37 |
| qlinks.caging.local_search_global | 9 | 9 | 256 |
| qlinks.models.local_terms | 9 | 9 | 68 |
| qlinks.operators.base | 9 | 9 | 257 |
| qlinks.qec.reporting | 8 | 28 | 107 |
| qlinks.caging.local_search_padding | 8 | 8 | 1339 |
Cycle diagnostics
Import-time SCCs use only eager module-scope imports and are split into API/re-export cycles (package initializers or known compatibility facades) versus implementation cycles. The secondary “type/lazy static” entries appear only when TYPE_CHECKING and function-local imports are included, so intentional typing or cycle-breaking imports are not mistaken for eager import cycles. Package-level import-time cycles are reported separately in the summary.
| Kind | Modules | Strongly connected component |
|---|---|---|
| API/re-export import-time | 2 | qlinks.basis → qlinks.basis.sectors |
| API/re-export import-time | 2 | qlinks.caging → qlinks.caging.stability |
| API/re-export import-time | 2 | qlinks.encoded → qlinks.encoded.flux |
| type/lazy static | 2 | qlinks.caging.classification → qlinks.caging.diagnostics |
Architecture guardrails
The report mirrors the broad dependency rules in AGENTS.md: caging/open-system separation, neutral local structure, temporary-facade isolation, and the focused local-search ordering. The dedicated pytest architecture tests remain the blocking source of truth for CI.
| Rule | Source | Target | Location | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| None detected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||