xgi.core.views.DiNodeView#
- class DiNodeView(H, bunch=None)#
Bases:
IDViewA IDView that keeps track of node ids.
Warning
This is currently an experimental feature.
- Parameters:
hypergraph (DiHypergraph) – The hypergraph whose nodes this view will keep track of.
bunch (optional iterable, default None) – The node ids to keep track of. If None (default), keep track of all node ids.
See also
Notes
In addition to the methods listed in this page, other methods defined in the stats package are also accessible via the NodeView class. For more details, see the tutorial.
Attributes
idsThe ids in this view.
Methods
Get the edge ids of which a node is a member.
Get the edge ids of which a node is a member.
Filter the IDs in this view by a statistic.
Filter the IDs in this view by an attribute.
Nodes that belong to no edges.
- dimemberships(n=None, dtype=<class 'dict'>)#
Get the edge ids of which a node is a member.
Gets all the node memberships for all nodes in the view if n not specified.
- Parameters:
n (hashable, optional) – Node ID. By default, None.
dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving
{node_id: (in_edges, out_edges)}. Passlistfor a plain list of(in_edges, out_edges)tuples, without node ids.
- Returns:
dict (if dtype is dict, default) – Mapping from node id to a
(in_edges, out_edges)tuple of edge sets.list (if dtype is list) – List of
(in_edges, out_edges)tuples, in view iteration order.tuple (if n is not None) – Directed memberships of node n as an
(in_edges, out_edges)tuple of edge sets.
- Raises:
XGIError – If n is not hashable or if it is not in the hypergraph, or if dtype is not dict or list.
- isolates()#
Nodes that belong to no edges.
When ignore_singletons is True, a node is considered isolated from the rest of the hypergraph when it is included in no edges of size two or more. In particular, whether the node is part of any singleton edges is irrelevant to determine whether it is isolated.
When ignore_singletons is False (default), a node is isolated only when it is a member of exactly zero edges, including singletons.
- Return type:
NodeView containing the isolated nodes.
See also
- memberships(n=None, dtype=<class 'dict'>)#
Get the edge ids of which a node is a member.
Gets all the node memberships for all nodes in the view if n not specified. For a directed hypergraph, this counts a node as a member of any edge whose head or tail contains it. See
DiNodeView.dimemberships()for the head/tail breakdown.- Parameters:
n (hashable, optional) – Node ID. By default, None.
dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving
{node_id: set_of_edges}. Passlistfor a plain list of edge sets, without node ids.
- Returns:
dict (if dtype is dict, default) – Mapping from node id to the set of edge memberships.
list (if dtype is list) – List of edge sets, in view iteration order.
set (if n is not None) – Node memberships, regardless of whether that node is a sender or receiver.
- Raises:
XGIError – If n is not hashable or if it is not in the dihypergraph, or if dtype is not dict or list.