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

@@ -69,6 +69,28 @@
;; --- current-db convenience layer ---
(define
relations-ap-dfs
(fn
(db b kind path node)
(if
(= node b)
(list path)
(relations-concat-map
(fn
(nbr)
(if
(relations-eng-member? nbr path)
(list)
(relations-ap-dfs db b kind (append path (list nbr)) nbr)))
(relations-children-of db node kind)))))
(define
relations-all-paths
(fn
(db a b kind)
(if (= a b) (list (list a)) (relations-ap-dfs db b kind (list a) a))))
(define
relations/path
(fn (a b kind) (relations-path (relations-ensure-db!) a b kind)))
@@ -84,3 +106,7 @@
(define
relations/reachable-any?
(fn (a b) (relations-reachable-any? (relations-ensure-db!) a b)))
(define
relations/all-paths
(fn (a b kind) (relations-all-paths (relations-ensure-db!) a b kind)))