Traversal v1 (2/4): the labeled traversal walker

AD
2h ago
+3327-0

Second of four stacked PRs for labeled traversal, on #708.

This PR adds traverse_seed, which extends a seed through the graph and keeps, on each path, the labels that carry every k-mer walked. The labels are named, or taken from the seed: those on every seed k-mer. A seed that no label carries fails with SeedDerivationError, so a caller can report it for that seed alone. Each arm returns a tree of segments, one path per leaf, the reason each label left, and complete_to_bp: the length up to which every walk is present.

A path never reuses an edge or steps back into the seed, so walks end on graphs with cycles. A label that continues on several successors spends one of its max_label_branches (default 0). With none left, it ends there. Fixed caps bound the work: 1,000,000 steps and a time budget per seed, 1000 live paths and 10,000 paths per arm, and 64 splits per path. A cap marks the arm truncated.

test_walker_reference checks every label end against a string model of the test records.

Co-authored-by: Gunnar Rätsch

🤖 Generated with Claude Code