Commit 372a6c6
test(metamorphic): directed distance-metric relations [br-r37-c1-e04a1]
Skill: /testing-metamorphic (different from this 30-min window's
/mock-code-finder, /profiling-software-performance,
/modes-of-reasoning-project-analysis, /porting-to-rust,
/testing-conformance-harnesses, /testing-fuzzing).
The directed-distance-metric wrapper fixes (br-r37-c1-89n9d
center/periphery and br-r37-c1-wojl3 diameter/radius) lacked
metamorphic-property coverage. The differential fuzz lock
(br-r37-c1-kitjs) catches divergence from nx, but if both libraries
drift the same way (e.g. nx is pinned to a buggy version), the
fuzz silently passes. Metamorphic guards catch nx-independent drift
because they're rooted in mathematical identities.
Adds 4 metamorphic-property tests, each parametrized over 5
random strongly-connected DiGraph seeds:
1. test_directed_diameter_invariant_under_reverse
diameter(G) == diameter(reverse(G)) — reversing every edge
maps each shortest u→v path to a shortest v→u path in the
reverse, so the max over all pairs is preserved.
2. test_directed_radius_diameter_ordering
radius(G) ≤ diameter(G) — fundamental inequality.
3. test_directed_center_is_subset_of_eccentricity_minimizers
center(G) == {n : ecc[n] == radius(G)} — definitional, verified
against an independent recomputation from fnx.eccentricity.
4. test_directed_periphery_is_max_eccentricity_set
periphery(G) == {n : ecc[n] == diameter(G)} — same, dual side.
All 4 hold by mathematical identity (independent of any nx behavior),
so they catch the case where both libs drift together.
86 metamorphic tests pass total (was 66) — 1 vacuous skip on the
older complement-of-disconnected-is-connected theorem.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 88a1038 commit 372a6c6
1 file changed
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
303 | 370 | | |
304 | 371 | | |
305 | 372 | | |
| |||
0 commit comments