Skip to content

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
add(slice_id, **attributes)

Create a new empty slice.

Parameters:

Name Type Description Default
slice_id str
required
**attributes Any

Slice attributes.

{}

Returns:

Type Description
str
remove
remove(slice_id)

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
add_edge_to_slice(lid, eid)

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
add_edges(slice_id, edge_ids)

Attach many existing edges to a slice and include their incident vertices.

get_slices_dict
get_slices_dict(include_default=True)

Return the raw slice_id → SliceRecord mapping (distinct from list).

list
list(include_default=True)

Slice IDs as a list.

add_vertex_to_slice
add_vertex_to_slice(lid, vid)

Attach an existing vertex to a slice.

Raises:

Type Description
KeyError

If the slice or vertex does not exist.