10. Linking Across Chunks and Levels

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, the source-side chunk coord and target-side chunk coord differ for the same physical region.

Both kinds live under links/<delta>/<offsets>/ with identical record structure; the <delta> path segment declares which case applies.

Connectivity is one array family, and an intra-chunk link is simply a link whose relative offsets are all zero — see §10.6. Factoring the relationship between endpoints into the path rather than into the cell coordinate is what makes every link array an ordinary chunk-grid array: it shards, enumerates and validates exactly like vertices does, and a record never names a chunk at all.

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 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 manifest in object_index/manifests 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 object’s manifest blob from object_index/manifests at row object_id.

  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 reads the non-intra offsets arrays under links/0/ at those chunks to recover edges bridging them.

The manifest blocks do NOT themselves carry cross-chunk edges — they carry chunk + fragment references. A manifest references vertex fragments only.

10.7 Consistency Guarantees

  • Chunk-local vertex indices. No record stores a global vertex ID. Every vi_k is local to chunk src + o_k, and that chunk is recovered from the cell coordinate plus the path — so there is nothing to reconstruct and no global-ID space to keep consistent.

  • Attribute parity. link_attributes/<name>/<delta>/<offsets> mirrors links/<delta>/<offsets> exactly: same offsets segments, same cells, same per-cell row order. Rows align 1:1 without storing a row id.

  • Uniform family policy. link_width, sid_ndim, directed and store are properties of the whole <delta> family, not of an individual offsets array. A store that needs two link widths at one level needs two deltas, not two segments.

  • Referential integrity. A record naming chunk src + o_k obliges that chunk to exist and to have at least vi_k + 1 vertices at the endpoint’s level. Deleting a chunk without deleting the records that reach into it leaves the store invalid.

  • Finalize before sharding. num_links and num_physical_records must be written before the store is sharded. Once cells are packed into shard files a shard’s inner index is no longer derivable from chunk-file names, so counts that would have been recovered by listing cannot be.