xgi.core.views.NodeView#
- class NodeView(H, bunch=None)[source]#
Bases:
IDView
An IDView that keeps track of node ids.
- Parameters:
hypergraph (Hypergraph) – 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
ids
The ids in this view.
Methods
Get the edge ids of which a node is a member.
Nodes that belong to no edges.
Find the neighbors of an ID.
Find IDs that have a duplicate.
Find IDs with the specified bipartite neighbors.
Filter the IDs in this view by a statistic.
Filter the IDs in this view by an attribute.
- isolates(ignore_singletons=False)[source]#
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.
- Parameters:
ignore_singletons (bool, optional) – Whether to consider singleton edges. By default, False.
- Return type:
NodeView containing the isolated nodes.
See also
- memberships(n=None)[source]#
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.
- Returns:
Edge memberships.
- Return type:
dict of sets if n is None, otherwise a set
- Raises:
XGIError – If n is not hashable or if it is not in the hypergraph.