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.
Owns the full slice implementation — SliceClass on AnnNet is a thin forwarding shell kept for callers that cannot be updated (e.g. adapters). State (_slices, _current_slice, _default_slice, slice_edge_weights) lives on AnnNet because it is accessed pervasively in core graph methods.
Functions
add_slice
Create a new empty slice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slice_id
|
str
|
|
required |
**attributes
|
Slice attributes. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
|
remove_slice
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 does not exist. |