Skip to content

get_snarl_tree_records(): number root components across all temporary indexes - #246

Merged
adamnovak merged 1 commit into
vgteam:masterfrom
parsaeskandar:vg-optimize-indexing
Oct 16, 2026
Merged

adamnovak merged 1 commit into
vgteam:masterfrom
parsaeskandar:vg-optimize-indexing

Conversation

@parsaeskandar

Copy link
Copy Markdown
Contributor

SnarlDistanceIndex::get_snarl_tree_records() accepts several temporary indexes, one per connected component. Each temporary index numbers its root components from 0, and the function passed that per-index number directly to RootRecordWriter::add_component() and set_rank_in_parent(). With more than one temporary index:

  • root components of later indexes overwrote the root-record slots of earlier ones;
  • different components got the same connected component number, which zipcodes use to tell components apart.

This keeps a running component_offset across the temporary indexes, so each root component gets a distinct slot and number. With a single temporary index, which every current caller passes, the offset is 0 and the output is unchanged.

vg uses this to build the distance index one connected component at a time, in parallel (vgteam/vg PR: VG_PR_LINK):

  • the full .dist of an HG002-sampled HPRC whole-genome graph (73 components) goes from 30m27s to 4m01s;
  • the top-level-chain index of the HPRC whole-genome graph goes from 52m to 10m.

Checked against the serial build: same snarl tree, a one-to-one mapping of component numbers, and identical minimum_distance() on 2M random position pairs.

… indexes

With more than one temporary index, root components of later indexes reused
root-record slots and connected component ranks starting from 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@adamnovak adamnovak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should work.

@adamnovak
adamnovak merged commit dbc5a14 into vgteam:master Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants