ADR 0105: Vertex records and float weights in batch files (AD13, M10’s section of the joint format decision)#
Status: Accepted (2026-11-11). The format decision is the author’s: AD13 (sheet D1), decided by the author on 2026-10-28 jointly with M11’s HD10 (GOVERNANCE.md’s approvals log, the row “The file formats of 0.4 (sheet D1-D2)”). The record layout, the messages, the tests and the fuzz coverage are accepted under delegation (GOVERNANCE.md, “Delegation of technical ADRs”), technical scope only. M10b step 2 (the M10b acceptance criterion 6; PLAN 5.7). M11’s section of the same decision is ADR 0087 (incidence edits, bit 3, the per-kind masks).
Date: 2026-11-11
Deciders: S M Shovan (AD13 / HD10); the AI assistant, on the author’s behalf (the rest)
Context#
label_propagation (0.4) applies vertex batches (arrivals with an optional seed label, the edges
they bring, departures) to float graphs. PLAN 5.7 lists +v u [label] / -v u among the .dgt
graph operations and leaves the .dgb layout to the release; 0.3 reserved both and refused them
loudly (.dgt: “reserved for the vertex batches of label_propagation”; .dgb: the weight code 3
and flag bit 4 rejected as unknown). Both formats are stable tier at version 1 (GOVERNANCE.md,
2026-10-22). AD13 decided how 0.4 adds to version 1:
.dgtstays%dgt 1, with+v u [label]/-v u(graph files) and float weight tokens for float graphs only; M11’s+i h v/-i h vare hypergraph operations;.dgbstays version 1, withbatch_dtype::float32 = 3in a graph file’s weight byte only andbatch_file_flags::vertex_records = 16U(bit 4, graph files only), M11’s bit 3incidence_editsfor hypergraph files, the masksknown_graph/known_hypergraph(M11a defined them;knowntheir union), the header checked per kind, the flags fixed at open;old readers refuse every addition loudly, and a file using none of them is byte-identical to what 0.3 writes;
docs/api/file_formats.mdstates once that such an addition is not a silent change of version 1 (M11a wrote that sentence; it is kept, not repeated).
Decision#
.dgt.read_batchesreads+v u [label](label-1,0,1, or none for -1) and-v uintoedge_batch::insert_vertex/delete_vertexfor every graph type (the batch semantics decide what they mean; onlynet_effect()graphs take them, ADR 0069), the ids by the edge rules. A hypergraph file refuses them (anio_errornamingread_batches()), as a graph file refuses+i/-i. Withweight_t = floata weight token is parsed bystd::from_chars<float>(general format) and must be finite: NaN, infinities and values beyond the float range are anio_errorat the token; integer graphs keepparse_integerand refuse such a token.write_batcheswrites, per batch,+vlines (labelonly for 0 or 1),-vlines, then the 0.3 lines; float weights in their shortest round-trip form (std::to_chars(float)). A batch without vertex operations is written as 0.3 writes it. A batch that has vertex operations before its first insertion keeps them when the reader learns K (the rebuild of the K-less batches copies them)..dgb: code 3.dtype_of<float>()isfloat32(4 bytes, the IEEE bits).header_problemaccepts code 3 only in a graph file’s weight byte: a hypergraph file with it, and code 3 as the vertex type, are rejected with messages naming the rule. The reader refuses a non-finite float32 weight (anio_errorat the record), as the text readers do..dgb: bit 4 and the 48-byte count block (M10’s layout proposal for the joint record rule, recorded first indocs/api/file_formats.md). Withvertex_recordsevery graph record’s count block is 48 bytes: the batch id, d, i (0.3’s 24 bytes), then n inserted vertices, l seed labels (0 or n) and x deleted vertices; after 0.3’s arrays (deletions, insertions, weights) follow the inserted vertices [n] (vertex type), the labels [l] (int8 in {-1, 0, 1}, zero-padded to 8 bytes) and the deleted vertices [x] (vertex type). Storing l separately keeps a view with no label array distinct from one whose labels are all -1 in.dgb(amended after M10b’s review:batch_reader’s views give back l = 0 as written; the two mean the same, no seed, and the owning paths normalize them:edge_batchalways holds one label per inserted vertex, soread_binary_batchesgives -1 labels for l = 0, and.dgtwrites no token for either; docs/api/file_formats.md).known_graph = vertex_records(an api-change line inbatch_io.hpp;knownstays the union). A hypergraph file with bit 4 is refused (“unknown flags 16 for a file of hypergraph batches”, so that M11a’s test of that refusal is unchanged), a graph file with bit 3 too (“flags 8 in a file of graph batches”).Flags fixed at open.
batch_writertakes its header’s flags at construction; a batch with vertex operations in a file opened withoutvertex_recordsraisesinvalid_argument_errorbefore anything is written; a file opened with it takes edge-only batches (zero vertex counts).write_binary_batchessets the flag only when some batch has a vertex operation, so a file of edge batches (also float ones) has the 24-byte count block and no flag. The batch checks are one function for both formats (check_edge_batch_arrays, with avertex_recordsswitch): ids>= 0, 0 or one label per inserted vertex in {-1, 0, 1}, finite float weights.Float edge lists (PLAN 6.4.7’s weighted edge-list path, the kNN recipe’s files):
read_edge_list<V, float>parses the weight columns with the same rule, keeping the float bits in the parser’s int64 weight array;write_edge_list<V, float>writes the shortest round-trip form and refuses a non-finite weight. The integer paths are unchanged;read_matrix_market,read_csr_tripletandread_legacy_batchstay integral (MOSP and CycleEnumeration-GPU formats).The readers of 0.3 refuse the additions loudly. 0.3’s
header_problemrejects weight code 3 (“weight type 3 (none = 0, int32 = 1 or int64 = 2)”) and, in a graph file, any flag (“unknown flags 16”); 0.3’s.dgtreader rejects+v/-v(“reserved for the vertex batches of label_propagation”) and a float token (“expected a decimal integer”). The same code paths remain in this library for the codes and bits it does not know (a weight code 4, flag 32: the testsVertexBatchBinary.ReadersRejectWhatTheyDoNotKnow), and the 0.3-era seeds still read and are written back byte for byte (M11a’sTheFilesOf03AreWrittenByteForByteAsBefore, the corpus replays).Fuzzing.
fuzz_batch_textgains the float graph type (option 2 = 6) and checks the vertex operations and their round trip;fuzz_batch_binaryinstantiates int32 / float32 and checks the vertex records and their round trip;fuzz_edge_listgains the float result type;fuzz_result_iogainsread_labels. New seeds:batch_text/vertex_ops_float,batch_binary/graph_float_vertex_records(written bymake_dgb_seeds.pyfrom the specification),edge_list/float_weights,result_io/labels.
Consequences#
The legacy generator’s batches at 5k5 and 50k round-trip through
.dgtand.dgbto identical batches (the float weights bit for bit;VertexBatchFiles.LegacyGeneratorBatchesRoundTrip).Python and the command line read and write these files in M10b step 3 (their readers refuse
vertex_recordsand code 3 until then, as 0.3’s did).A new weight code or flag remains a version question under the rule of the format page’s introduction.
Alternatives considered#
Always n labels (-1 filled in). Rejected: an
edge_batch_viewmay carry no label array, and the round trip would not give back the same view.A new format version 2. Rejected by AD13: the additions are refused loudly by every earlier reader.
Accepting NaN / infinity in float tokens. Rejected: label_propagation’s similarity weights are finite by contract, and a non-finite weight would poison the sums silently.