Skip to content

Native .annnet Format

Primary read and write entry points from annnet.io.annnet_format.

annnet.io.annnet_format.write

write(
    graph,
    path,
    *,
    compression="zstd",
    overwrite=False,
    matrix=False
)

Write an AnnNet graph to a directory or .annnet archive.

Parameters:

Name Type Description Default
matrix bool

Also persist the incidence matrix. The records are the source of truth and fully reconstruct it, so this is a size/load-time trade rather than a correctness one: with it omitted, read() defers a rebuild until the matrix is first touched. Explicit coefficients persist either way, as records data.

False

annnet.io.annnet_format.read

read(path, *, lazy=False)

Load graph from disk with zero loss.

Parameters:

Name Type Description Default
path str | Path

Path to .annnet directory

required
lazy bool

If True, delay loading large arrays until accessed

False

Returns:

Type Description
AnnNet

Reconstructed graph with all topology and metadata