Views
View helpers from annnet.core._Views.
Use G.view(...) for graph view workflows. Direct imports from underscore
modules follow the internal API policy.
annnet.core._Views.GraphView
Lazy, filtered view into a graph; materialize() for a concrete subgraph.
Attributes
obs
property
Return the filtered node attribute table for this view.
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Materialized from the node table of the graph and filtered by the node ids of this view. It is a table for the caller, not the storage of the graph.
var
property
Return the filtered edge attribute table for this view.
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Materialized from the edge table of the graph and filtered by the edge ids of this view. It is a table for the caller, not the storage of the graph.
node_ids
property
Get filtered node IDs (cached).
Returns:
| Type | Description |
|---|---|
set[str] | None
|
None means no node filter (full graph). |
edge_ids
property
Get filtered edge IDs (cached).
Returns:
| Type | Description |
|---|---|
set[str] | None
|
None means no edge filter (full graph). |
node_count
property
Return the number of nodes in this view.
Returns:
| Type | Description |
|---|---|
int
|
|
edge_count
property
Return the number of edges in this view.
Returns:
| Type | Description |
|---|---|
int
|
|
Functions
edges_df
Return an edge DataFrame view filtered to this view's edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Passed through to |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Uses AnnNet.edges_view() and then filters by the view's edge IDs.
nodes_df
Return a node DataFrame view filtered to this view's nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Passed through to |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Uses AnnNet.nodes_view() and then filters by the view's node IDs.
materialize
Create a concrete subgraph from this view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy_attributes
|
bool
|
If True, copy node/edge attributes into the new graph. |
True
|
Returns:
| Type | Description |
|---|---|
AnnNet
|
Materialized subgraph. |
subview
Create a new GraphView by further restricting this view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes
|
Iterable[str] | callable | None
|
Node IDs or predicate; intersects with current view if provided. |
None
|
edges
|
Iterable[str] | callable | None
|
Edge IDs or predicate; intersects with current view if provided. |
None
|
slices
|
Iterable[str] | None
|
Slice IDs to include. Defaults to current view's slices if None. |
None
|
predicate
|
callable | None
|
Additional node predicate applied in conjunction with existing filters. |
None
|
Returns:
| Type | Description |
|---|---|
GraphView
|
|
Notes
Predicates are combined with logical AND.
annnet.core._Views.ViewsClass
Materialized table builders mixed into AnnNet.
Functions
edges_view
edges_view(
slice=None,
include_directed=True,
include_weight=True,
resolved_weight=True,
copy=True,
)
Build a DataFrame view of edges with optional slice join.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slice
|
str
|
Slice ID to join per-slice attributes. |
None
|
include_directed
|
bool
|
Include directedness column. |
True
|
include_weight
|
bool
|
Include global weight column. |
True
|
resolved_weight
|
bool
|
Include effective weight (slice override if present). |
True
|
copy
|
bool
|
Return a cloned DataFrame if True. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Vectorized implementation avoids per-edge scans.
nodes_view
Read-only node attribute table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy
|
bool
|
Return a cloned DataFrame. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
Columns include |
slices_view
Read-only slice attribute table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy
|
bool
|
Return a cloned DataFrame. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
One row per slice (including the default slice), keyed by
|
aspects_view
Return a view of Kivela aspects and their metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy
|
bool
|
Return a cloned DataFrame. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Columns include aspect, elem_layers, and any aspect attribute keys.
layers_view
Return a read-only table of multi-aspect layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
copy
|
bool
|
Return a cloned DataFrame. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame - like
|
|
Notes
Columns include layer_tuple, layer_id, aspect columns, layer attributes,
and prefixed elementary layer attributes.
annnet.core._Views.ViewsAccessor
Namespace for materialized graph tables (G.views).
Functions
entity_kinds
Return the kind of every entity, as a mapping from its id.
An entity is a node, or an edge that is a node in its own right. The answer is built on each call, so changing it changes nothing.