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.
State (_slices, _current_slice, _default_slice,
slice_edge_weights) lives on AnnNet because it is accessed
pervasively in core graph methods; this class is the user-facing API
surface over that state.
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 vertices.
get_slices_dict
Return the raw slice_id → SliceRecord mapping (distinct from list).