relations: route enumeration — all-paths (all simple directed paths a->b) + 9 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s

Cycle-safe DFS in explain.sx, complements shortest-path relations-path. 135/135.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 13:18:49 +00:00
parent e6ffc60040
commit b66395886b
6 changed files with 174 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ links. Reuses `lib/datalog/` — does not reimplement the engine.
## Status (rolling)
`bash lib/relations/conformance.sh`**126/126** (Phases 14 complete + extensions)
`bash lib/relations/conformance.sh`**135/135** (Phases 14 complete + extensions)
## Ground rules
@@ -108,9 +108,18 @@ lib/relations/federation.sx
(lowest common ancestors — a set; tree → singleton, DAG → may be several),
`topo-order` (Kahn-style; nil for cyclic kinds). New `lib/relations/tree.sx`,
computed in SX over `reach`/`ancestors`/`rnode`. `lib/relations/tests/tree.sx`.
- [x] **route enumeration**`all-paths` (all simple directed paths a→b, not just
the shortest; cycle-safe DFS) in explain.sx. `lib/relations/tests/routes.sx`.
## Progress log
- **Extension: route enumeration** (135/135). `relations-all-paths(db,a,b,kind)`
in explain.sx — every simple (no repeated node) directed path a→b, not just the
shortest one `relations-path` returns; DFS that skips nodes already on the
current path so cyclic data terminates; a=b → `((a))`, no route → `()`. Reuses
engine's `relations-concat-map`/`-eng-member?`/`children-of`. + `relations/all-paths`
wrapper, `lib/relations/tests/routes.sx` (9 tests: two-route diamond, single
route, no route, self, route-through-cycle, route count, kind isolation).
- **Extension: tree/DAG queries** (126/126). New `lib/relations/tree.sx`:
`relations-common-ancestors` (intersection of the two ancestor sets),
`relations-lca` (common ancestors with no other common ancestor reachable below