xgi.core.diviews.DiNodeView

class xgi.core.diviews.DiNodeView(H, bunch=None)[source]

Bases: DiIDView

An DiIDView 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

DiIDView

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

memberships

Get the edge ids of which a node is a member.

dimemberships

Get the edge ids of which a node is a member.

filterby

Filter the IDs in this view by a statistic.

filterby_attr

Filter the IDs in this view by an attribute.

isolates

Nodes that belong to no edges.

dimemberships(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:

otherwise the directed memberships of a single node.

Return type:

dict of directed node memberships if n is None,

Raises:

XGIError – If n is not hashable or if it is not in the hypergraph.

isolates()[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.

Return type:

NodeView containing the isolated nodes.

See also

EdgeView.singletons()

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:

Node memberships, regardless of whether that node is a sender or receiver.

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 dihypergraph.