Algorithms
Traversal
annnet.algorithms.traversal.Traversal
Functions
neighbors(entity_id)
Neighbors of an entity (vertex or edge-entity).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Adjacent entities. For hyperedges, uses head/tail orientation. |
out_neighbors(vertex_id)
Out-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
successors(vertex_id)
Successors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
in_neighbors(vertex_id)
In-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
predecessors(vertex_id)
In-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
Internal helpers
Functions
neighbors(entity_id)
Neighbors of an entity (vertex or edge-entity).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Adjacent entities. For hyperedges, uses head/tail orientation. |
out_neighbors(vertex_id)
Out-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
successors(vertex_id)
Successors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
in_neighbors(vertex_id)
In-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
predecessors(vertex_id)
In-neighbors of a vertex under directed semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vertex_id
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
Lazy Proxies (NetworkX, igraph, graph-tool)
These proxies provide a thin, lazy bridge to optional backends. Internal proxy classes and helper functions are intentionally hidden from this reference; see the source if you need implementation details.
annnet.core.lazy_proxies.nx_lazyproxy._LazyNXProxy
Lazy NetworkX proxy attached to an AnnNet instance.
This proxy lets you call NetworkX algorithms as G.nx.<algo>(...). On first
use (or after a graph mutation), AnnNet is converted to a NetworkX graph
and cached; subsequent calls reuse the cached backend until the AnnNet
version changes.
Conversion produces a manifest dictionary that preserves information
NetworkX cannot represent (e.g., hyperedges, per-edge directedness, slices,
multilayer metadata, stable edge IDs). The manifest is JSON-serializable
and can be persisted with annnet.adapters.networkx_adapter.save_manifest.
Notes
- Requires the optional
networkxdependency. - The typical usage pattern is
G.nx.algorithm(...), which lazily converts, runs the NetworkX algorithm, and returns its output.
annnet.core.lazy_proxies.ig_lazyproxy._LazyIGProxy
Lazy igraph proxy attached to an AnnNet instance.
This proxy lets you call igraph algorithms as G.ig.<algo>(...). On first
use (or after a graph mutation), AnnNet is converted to an igraph graph
and cached; subsequent calls reuse the cached backend until the AnnNet
version changes.
Conversion is optimized for speed and does not build a manifest. This means features that require a manifest (slices, reified hyperedges, multilayer metadata, stable edge IDs) are not preserved on the proxy path. Use adapters.igraph_adapter.to_igraph(...) for full-fidelity export.
Notes
- Requires the optional
python-igraphdependency. - The typical usage pattern is
G.ig.algorithm(...), which lazily converts, runs the igraph algorithm, and returns its output. _ig_simple=Truecollapses parallel edges to a simple graph;_ig_edge_aggscontrols aggregation (e.g.,{"weight":"min","capacity":"sum"}).
annnet.core.lazy_proxies.gt_lazyproxy._LazyGTProxy
Lazy graph-tool proxy attached to an AnnNet instance.
This proxy lets you call graph-tool algorithms via namespaces such as:
G.gt.topology.shortest_distance(...), G.gt.centrality.betweenness(...),
and G.gt.flow.push_relabel_max_flow(...).
On first use (or after a graph mutation), AnnNet is converted to a graph-tool graph and cached; subsequent calls reuse the cached backend until the AnnNet version changes. Conversion produces a manifest dictionary that preserves information graph-tool cannot represent (e.g., hyperedges, per-edge directedness, slices, multilayer metadata, stable edge IDs). The manifest is JSON-serializable and can be persisted by the adapter.
Notes
- Requires the optional
graph-tooldependency (not on PyPI). - The typical usage pattern is
G.gt.<namespace>.<algo>(...), which lazily converts, runs the graph-tool algorithm, and returns its output.