Cache
Cache helpers from annnet.core._Matrix.
Use G.cache for graph-owned cache helpers. Direct imports from
underscore modules follow the internal API policy.
annnet.core._Matrix.CacheManager
Materialized matrix cache manager.
The cache manager owns derived sparse representations such as CSR, CSC, and adjacency. Cached values are invalidated against the graph version counter.
Attributes
csr
property
Return the CSR (Compressed Sparse Row) matrix.
Returns:
| Type | Description |
|---|---|
csr_matrix
|
|
Notes
Built and cached on first access.
csc
property
Return the CSC (Compressed Sparse Column) matrix.
Returns:
| Type | Description |
|---|---|
csc_matrix
|
|
Notes
Built and cached on first access.
adjacency
property
Return the adjacency matrix computed from incidence.
Returns:
| Type | Description |
|---|---|
spmatrix
|
|
Notes
For incidence matrix B, adjacency is computed as A = B @ B.T.
Functions
has_adjacency
Check whether a valid adjacency cache exists.
Returns:
| Type | Description |
|---|---|
bool
|
|
get_adjacency
Return the cached adjacency matrix.
Returns:
| Type | Description |
|---|---|
spmatrix
|
|
invalidate
Invalidate cached formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formats
|
list[str]
|
Formats to invalidate ( |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|
build
Pre-build specified formats (eager caching).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formats
|
list[str]
|
Formats to build ( |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|