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.

Attributes

active property writable
active

Currently active slice identifier.

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.

exists
exists(slice_id)

Return True if a slice exists.

count
count()

Return the number of registered slices.

info
info(slice_id)

Vertices, edges, and attributes of a slice.

vertices
vertices(slice_id)

Return a copy of the vertex IDs in a slice.

edges
edges(slice_id)

Return a copy of the edge IDs in a slice.

union
union(slice_ids)

Return the union of vertices and edges across multiple slices.

intersect
intersect(slice_ids)

Return the intersection of vertices and edges across multiple slices.

difference
difference(slice_a, slice_b)

Return the vertices and edges present in one slice but not another.

create_slice_from_operation
create_slice_from_operation(
    result_slice_id, operation_result, **attributes
)

Create a new slice from a precomputed membership result.

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.

union_create
union_create(slice_ids, name, **attributes)

Create a slice from the union of existing slices.

intersect_create
intersect_create(slice_ids, name, **attributes)

Create a slice from the intersection of existing slices.

difference_create
difference_create(slice_a, slice_b, name, **attributes)

Create a slice from the difference of two slices.

aggregate
aggregate(
    source_slice_ids,
    target_slice_id,
    method="union",
    weight_func=None,
    **attributes
)

Build a target slice from sources via 'union' or 'intersection'.

stats
stats(include_default=True)

Return per-slice counts and attributes.

vertex_presence
vertex_presence(vertex_id, include_default=False)

List slices that contain a given vertex.

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
hyperedge_presence(
    *,
    members=None,
    head=None,
    tail=None,
    include_default=False
)

Slices containing a hyperedge by undirected members or directed head+tail.

conserved_edges
conserved_edges(min_slices=2, include_default=False)

Count edges that appear in at least min_slices slices.

specific_edges
specific_edges(slice_id)

Return edges that appear only in the given slice.

temporal_dynamics
temporal_dynamics(ordered_slices, metric='edge_change')

Summarize added and removed members across an ordered slice sequence.

summary
summary()

Return a compact human-readable summary of all slices.