ocaml: phase 5.1 tarjan_scc.ml baseline (8-node digraph, 4 SCCs)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Tarjan's strongly-connected components in a single DFS using
index/lowlink:
graph (8 nodes, directed):
0 -> 1 -> 2 -> 0 (3-cycle)
2 -> 3
3 -> 4
4 -> 5 -> 6 -> 4 (3-cycle)
4 -> 7
SCCs: {0,1,2}, {3}, {4,5,6}, {7} = 4 components
Module-level ref + array state (index_arr, lowlink, on_stack,
stack, scc_count). When lowlink(v) = index(v), pop from stack
until v is removed; that's a complete SCC.
Tests: recursive function with module-level mutable state,
nested begin/end branches inside List.iter closure, inner
`let rec pop ()` traversing a ref-of-list, pattern match on
[] / h :: rest cons-list shape.
154 baseline programs total.
This commit is contained in:
@@ -407,6 +407,15 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-10 Phase 5.1 — tarjan_scc.ml baseline (Tarjan's
|
||||
strongly-connected components on 8-node digraph → 4 SCCs).
|
||||
Graph: 0→1→2→0 (cycle) plus 2→3, 3→4, 4→5→6→4 (cycle), 4→7.
|
||||
SCCs: {0,1,2}, {3}, {4,5,6}, {7} = 4 components. Single DFS
|
||||
with index/lowlink, on-stack flag, pop until root when
|
||||
lowlink = index. Tests recursive functions with module-level
|
||||
ref + array state, nested begin/end branches inside List.iter
|
||||
closure, inner `let rec pop ()` walking ref-of-list, pattern
|
||||
match on `[] | h :: rest`. 154 baseline programs total.
|
||||
- 2026-05-10 Phase 5.1 — lev_iter.ml baseline (iterative
|
||||
Levenshtein DP, sum of 5 distances = 16). Rolling-array DP
|
||||
(O(min(m,n)) space). Distances: kitten→sitting=3, saturday→
|
||||
|
||||
Reference in New Issue
Block a user