Instruction file imported from louie-mansour/wikilinks (
.cursor/rules/adjacency-format.mdc). Copyright stays with the author.
description: Go graph loader — implement against the adjacency CSR API contract globs: **/*.go alwaysApply: false
Graph bundle loader (Go)
Contract (normative): datapipeline/decisions/adjacency-csr.md — read this first. It defines files, encoding, validation, and hydration steps.
Go-specific guidance
- mmap the four
.binfiles viagolang.org/x/sys/unixorsyscall; do notio.ReadAllat ~29M edges. - Parse as little-endian
uint32usingencoding/binarywithbinary.LittleEndian. - Validate all §5 checks at startup before serving requests.
- Build
titleToID map[string]uint32while streamingentities.tsvif the API accepts titles. - BFS on integer IDs only; call
title(id)when formatting result paths.
Reference code
- Python writer:
datapipeline/lib/csr.py,datapipeline/stages/build_adjacency.py - Golden test:
datapipeline/tests/test_build_adjacency.py(assert fixture values from contract §7)
Avoid
- Re-parsing
edges_int.tsvor rebuilding adjacency at runtime - String-keyed adjacency or title-based BFS frontiers
- Native-endian reads without explicit LE conversion
- Assuming unique or sorted neighbors