10. Cross-Chunk Linking

10.1 Problem Statement

Many objects span more than one spatial chunk — a neuron skeleton that runs through six chunks, a streamline whose path crosses several boundaries, a mesh with triangle faces straddling a seam. Within a chunk, vertex indices are chunk-local and have no global meaning; some additional structure must carry connectivity across chunk boundaries.

This chapter covers two distinct cross-chunk concepts that the schema treats uniformly under one array family:

  • Cross-spatial-chunk links at one resolution level (delta = 0). Endpoints in two different chunks at the SAME pyramid level — the classic “two chunks of one skeleton, with an edge linking them.”

  • Cross-pyramid-level links between resolution levels (delta 0). Endpoints at the source level paired with endpoints at source + delta. When the coarse level also grows chunk_shape (v0.7), the source-side chunk coord and target-side chunk coord differ for the same physical region — the format handles this by carrying both endpoints’ chunk coords explicitly in every record.

Both kinds live at cross_chunk_links/<delta>/data with identical record structure; the level_delta field in the array’s .zattrs declares which case applies.

10.2 Strategy 1: Boundary Deduplication

  • Principle: vertices on chunk boundaries are duplicated into both adjacent chunks. Connectivity is implicit by coordinate matching at read time.

  • Setting: cross_chunk_strategy = "boundary_deduplication".

  • Cost: one extra vertex row per shared boundary point (and one extra fragment entry).

  • Advantages: simplest read path — readers don’t need to consult any cross-chunk index.

  • Disadvantages: requires precise coordinate alignment; floating- point round-trips can de-align “shared” points; doesn’t scale to cross-pyramid-level cases.

10.4 Strategy Selection

Stores set cross_chunk_strategy in root metadata; the default is "explicit_links". The third option, "both", emits both representations — useful for stores whose readers may not all support explicit cross-chunk links.

Picking guidance:

Use case

Strategy

Skeleton with strict integer voxel-coordinate vertices

either; deduplication is simplest

Streamline / polyline with float vertices

explicit_links

Mesh with shared rim triangles

explicit_links (link_width=3)

Any v0.7 pyramid with chunk-scale growth

explicit_links (required for cross-pyramid records)

10.5 Object Index for Cross-Chunk Objects

When an object spans chunks, its object_index/data manifest carries one block per chunk it touches. Each block names one chunk and a fragment reference (mode-0 / mode-1 / mode-2). To reconstruct the object, a reader:

  1. Reads the per-object manifest from object_index/data.

  2. For each block, decodes the named chunk’s vertex_fragments/<chunk> to find which rows of vertices/<chunk> belong to the object.

  3. Optionally walks cross_chunk_links/0/data to recover edges bridging the chunks.

The manifest blocks do NOT themselves carry cross-chunk edges — they carry chunk + fragment references. Edges across chunk seams are a separate concern handled by cross_chunk_links/0/data.

10.6 Consistency Guarantees

A writer that emits cross-chunk records is responsible for:

  • Every endpoint’s chunk coordinates exist (the chunk has a vertices/<chunk> blob at that level).

  • Every endpoint’s local_vertex_index falls within the chunk’s vertex count.

  • The link_width matches the array’s .zattrs.link_width.

  • The parallel attribute array (if emitted) has the same row count as the link array — a desynchronized write fails loudly at read time.

Level-3 consistency validation (§13.1) checks these invariants across cross_chunk_links/<delta>/data for every delta present.