Slices
Slice management from annnet.core._Slices.
Use G.slices and the AnnNet slice methods for slice workflows. Direct
imports from underscore modules follow the internal API policy.
annnet.core._Slices.SliceManager
Namespace for all slice operations, exposed as G.slices.
Attributes
Functions
add
Create a new empty slice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slice_id
|
str
|
|
required |
**attributes
|
Any
|
Slice attributes. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
|
remove
Remove a non-default slice and its per-slice attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slice_id
|
str
|
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If attempting to remove the internal default slice. |
KeyError
|
If the slice does not exist. |
add_edge_to_slice
Attach an existing edge to a slice (no weight changes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lid
|
str
|
|
required |
eid
|
str
|
|
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the slice or edge does not exist. |
add_edges
Attach many existing edges to a slice and include their incident nodes.
attach_edges
Attach every edge the graph holds to a slice, and derive no nodes.
Unlike :meth:add_edges, this keeps an edge that occupies no column, so a
placeholder edge survives a round trip. It also leaves the node
memberships alone. A reader that restores the node memberships from the
file itself needs both, and deriving them again is the dearest loop of a
load.
get_slices_dict
Return the raw slice_id → SliceRecord mapping (distinct from list).
attrs
Return every attribute of one slice.
A slice is a level of its own, so its attributes are held apart from the attributes of the nodes and the edges it holds.
difference
Return the nodes and edges present in one slice but not another.
create_slice_from_operation
Create a new slice from a precomputed membership result.
add_node_to_slice
Attach an existing node to a slice.
Raises:
| Type | Description |
|---|---|
KeyError
|
If the slice or node does not exist. |
union_create
Create a slice from the union of existing slices.
intersect_create
Create a slice from the intersection of existing slices.
difference_create
Create a slice from the difference of two slices.
aggregate
Build a target slice from sources via 'union' or 'intersection'.
edge_presence
edge_presence(
edge_id=None,
source=None,
target=None,
*,
include_default=False,
undirected_match=None
)
Slices containing an edge by id, or by (source, target) endpoint pair.
hyperedge_presence
Slices containing a hyperedge by undirected members or directed head+tail.
conserved_edges
Count edges that appear in at least min_slices slices.
temporal_dynamics
Summarize added and removed members across an ordered slice sequence.