Skip to content

Let the canvas answer a hand, and the search answer with a set - #53

Merged
Paururo merged 2 commits into
mainfrom
feat/tree-pointer
Aug 30, 2026
Merged

Let the canvas answer a hand, and the search answer with a set#53
Paururo merged 2 commits into
mainfrom
feat/tree-pointer

Conversation

@Paururo

@Paururo Paururo commented Aug 30, 2026

Copy link
Copy Markdown
Member

Three of the four things the Taxonium study said were clearly worth doing and
that the viewer still did not do. The fourth, carrying trait values over the
layout wire, is a week of work and is not here.

The picture said nothing about itself

A reader could see a branch and had no way to learn what it was short of
exporting the figure. The canvas answers a pointer now: what is under it is
named, with how many tips lie beyond it and how deep it sits, and a click takes
that clade.

Measured on a twenty thousand tip tree: pointing at a branch with 32 tips beyond
it and clicking goes from 20,000 rows in view to 36, with the exported command
following to --focus L3_10238,L4.9_10273. Each hover costs 0.04 ms, because
the search is over what the last paint drew rather than over the tree: a reader
can only point at what is on the screen, and what is on the screen is a few
thousand branches however many the tree has.

How many tips lie beyond a branch is worked out once, the first time something
asks, by counting children off rather than by walking, so it does not care what
order the nodes arrived in and cannot run out of stack on a ladder.

The search found one tip and went to it

It answers with every tip that matches now, marks them all, and says how many.
Enter again steps to the next and Shift with it steps back. A part of a name
works, so does a list pasted in with commas or newlines, and case is folded.

Reading the names as bytes rather than decoding each of them is what makes that
affordable. On 1,999,999 nodes:

search before now
a lineage prefix, 158,018 hits about 2,000 ms 144 ms
an exact name about 2,000 ms 17 ms
a list of two names not possible 27 ms
stepping to the next hit not possible 20 ms

The before column is what the study measured on the old one-shot search.

And a figure can be exported with them marked

--highlight <NAMES> reaches the clade highlighting the library already had.
highlight_named does nothing when it cannot find the name, which is a choice
for a library call and a lie for a command line: the figure comes out with one
clade fewer than was asked for and nothing says so. The flag refuses instead,
naming what the file has, the way --carrying already does:

karyon: --tree outbreak.nwk has no clade called NOT_A_TIP; it has EPI_0000,
EPI_0001, EPI_0002, ... and 36 more

The viewer carries what a search found into the command it prints, but only when
there are few enough to read: two names become --highlight L2_00000,L3_19999,
and a search matching 6,392 tips stays a thing you look at on the page.

Checks

46 in tests/tree-canvas.test.js, five of them new negative controls, plus one
in the crate for the refusal. Answering for whatever is nearest however far off
fails one; counting tips wrong fails another; taking a fixed span instead of the
clade fails a third; stopping the search at the first hit, not folding case, and
letting a prefix match the middle of a name each fail one of the search checks;
and letting the unknown clade through fails the Rust one.

The picture said nothing about itself. A reader could see a branch and had no
way to learn what it was without exporting the figure, so the canvas answers
now: what is under the pointer is named, with how many tips lie beyond it and
how deep it sits, and a click takes that clade. On a twenty thousand tip tree
clicking a branch with thirty two tips beyond it goes from twenty thousand
rows in view to thirty six, and each hover costs four hundredths of a
millisecond because the search is over what the last paint drew rather than
over the tree.

The search found one tip and went to it. It answers with every tip that
matches now, marks them all, and says how many; Enter again steps to the next
and Shift with it steps back. A part of a name works, so does a list pasted
in, and case is folded. Reading the names as bytes instead of decoding each
of them took a lineage prefix across two million nodes from about two seconds
to a hundred and forty four milliseconds, and an exact name to seventeen.
… not got

The library could draw a band behind a named clade and nothing outside it
could ask for one. highlight_named does nothing when it cannot find the name,
which is a choice for a library call and a lie for a command line: the figure
comes out with one clade fewer than was asked for and nothing says so. The
flag refuses instead, naming what the file has, the way asking who carries a
change already does.

The viewer carries what a search found into the command it prints, so the
figure a reader exports has the tips they went looking for marked on it. Only
when there are few enough of them to read: a search that matched six thousand
tips stays a thing you look at on the page.
@github-actions github-actions Bot added documentation Improvements or additions to documentation cli The command line front end tests The test suites and the property net labels Aug 30, 2026
@Paururo
Paururo merged commit f4b275e into main Aug 30, 2026
13 checks passed
@Paururo
Paururo deleted the feat/tree-pointer branch August 30, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli The command line front end documentation Improvements or additions to documentation tests The test suites and the property net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant