History
anet.history logs changes to the graph and takes snapshots that you can
compare.
A snapshot compares the sets of node, edge and slice IDs. It does not keep
attribute values, and it cannot restore an earlier graph. The log does not
record all changes: edge removal and attribute updates are not in it. To keep a
state of an analysis, write the graph to a native .annnet file. The
computation guide shows an example.
annnet.core._History.GraphDiff
Set difference between two graph snapshots (nodes/edges/slices added/removed).
Functions
summary
Return a human-readable summary of differences.
Returns:
| Type | Description |
|---|---|
str
|
Summary text describing added/removed nodes, edges, and slices. |
annnet.core._History.History
Mutation logging, version counter, snapshots, and diffs (mixed into AnnNet).
Functions
export_history
Write the mutation history to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Output path. Supported extensions: |
required |
Returns:
| Type | Description |
|---|---|
int
|
Number of events written. Returns 0 if the history is empty. |
Raises:
| Type | Description |
|---|---|
OSError
|
If the file cannot be written. |
Notes
Unknown extensions default to Parquet by appending .parquet.
enable_history
Enable or disable in-memory mutation logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flag
|
bool
|
When True, start/continue logging; when False, pause logging. |
True
|
Returns:
| Type | Description |
|---|---|
None
|
|
clear_history
Clear the in-memory mutation log.
Returns:
| Type | Description |
|---|---|
None
|
|
Notes
This does not delete any files previously exported.
mark
Insert a manual marker into the mutation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Human-readable tag for the marker event. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Notes
The event is recorded with op='mark' alongside standard fields
(version, ts_utc, mono_ns). Logging must be enabled for the
marker to be recorded.
annnet.core._History.HistoryAccessor
Callable anet.history namespace for logs and snapshots.